Created
November 22, 2020 08:10
-
-
Save sunilkumarmedium/36d9faca55e8f623aa4a5e6bca9e5668 to your computer and use it in GitHub Desktop.
UserMap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace CleanArchitectureApp.Infrastructure.Persistence.Repositories | |
{ | |
public partial class UserMap : ClassMapping<Domain.User> | |
{ | |
public UserMap() | |
{ | |
Schema("dbo"); | |
Table("Users"); | |
Lazy(true); | |
Id(x => x.UserId, map => | |
{ | |
map.Generator(Generators.Guid); | |
map.Column("UserId"); | |
map.UnsavedValue(Guid.Empty); | |
}); | |
Property(x => x.UserName, map => { map.NotNullable(true); map.Length(50); }); | |
Property(x => x.FirstName, map => { map.NotNullable(true); map.Length(50); }); | |
Property(x => x.LastName, map => map.Length(50)); | |
Property(x => x.UserEmail, map => { map.NotNullable(true); map.Length(50); }); | |
Property(x => x.PasswordHash, map => map.NotNullable(true)); | |
Property(x => x.PasswordSalt, map => map.NotNullable(true)); | |
Property(x => x.CreatedDate, map => map.NotNullable(true)); | |
Property(x => x.UpdatedDate); | |
Property(x => x.CreatedBy, map => map.NotNullable(true)); | |
Property(x => x.UpdatedBy); | |
ManyToOne(x => x.UserStatuses, map => { map.Column("UserStatusId"); map.Cascade(Cascade.All); map.Fetch(FetchKind.Select); }); | |
Bag(x => x.UserTokens, colmap => { colmap.Key(x => x.Column("UserId")); colmap.Inverse(true); colmap.Cascade(Cascade.Persist); }, map => { map.OneToMany(a => a.Class(typeof(UserToken))); }); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment