Created
April 19, 2016 14:11
-
-
Save ewhitmore/0ebbd0376a1914d4118fc0f7e7d890c4 to your computer and use it in GitHub Desktop.
NHibernate Base Map
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
public abstract class EntityBaseMap<T> : ClassMap<T> where T : EntityBase<T> | |
{ | |
protected EntityBaseMap() | |
{ | |
DynamicUpdate(); // Hibernate will update the modified columns only. | |
Id(x => x.Id).Column("Id"); // Numberic Id | |
Map(x => x.IsDeleted); | |
Map(x => x.CreatedAt); | |
OptimisticLock.Version(); | |
// DateTime2 is not a valid SQLITE database type. To use DateTime2 with SQLITE | |
// you need to extend the SQLITE Dialect and | |
Version(x => x.ModifiedAt).Column("ModifiedAt").CustomType("DateTime2"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment