33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
namespace IntegrationTests.Models.Mapping
|
|
{
|
|
public class PasswordResetRequestMap : EntityTypeConfiguration<PasswordResetRequest>
|
|
{
|
|
public PasswordResetRequestMap()
|
|
{
|
|
// Primary Key
|
|
this.HasKey(t => t.Id);
|
|
|
|
// Properties
|
|
this.Property(t => t.UserId)
|
|
.IsRequired()
|
|
.HasMaxLength(128);
|
|
|
|
// Table & Column Mappings
|
|
this.ToTable("PasswordResetRequest");
|
|
this.Property(t => t.Id).HasColumnName("Id");
|
|
this.Property(t => t.UserId).HasColumnName("UserId");
|
|
this.Property(t => t.Token).HasColumnName("Token");
|
|
this.Property(t => t.ValidUntil).HasColumnName("ValidUntil");
|
|
|
|
// Relationships
|
|
this.HasRequired(t => t.AspNetUser)
|
|
.WithMany(t => t.PasswordResetRequests)
|
|
.HasForeignKey(d => d.UserId);
|
|
|
|
}
|
|
}
|
|
}
|