MapInheritedProperties
Since the problem with SQL server I have been wondering what is the best strategy to sync database between client and server.
One option is to add TimeStamp attribute and using logical delete so I can sync deleted data too. But I am reluctant to use logical delete because it will affect my data query in every entity to exclude logical deleted data.
If I don't want to use logical delete, My sync service must be able to recognized deleted data. That is also problematic. Then I'm back to option one, logical delete.
Fortunately, I'm using a generic repository. So I can easily alter physical delete to logical delete in repository to affect all entity. Also in repository, I alter the query to exclude logical deleted data.
Also fortunately I'm using EntityBase class so I can easily add property to all my entity.
Found out that char is not map to database by EF. To workaround this I can use Data Annotation or EntityTypeConfiguration and pass it to modelbuilder.
Data Annotations
[StringLength( 36 )] [Column( TypeName = "char" )] public string UserIdentifier{ get; set; }
Fluent API
class UserProfileConfiguration:EntityTypeConfiguration<UserProfile> { public UserProfileConfiguration() { this.Property(p => p.UserIdentifier) .HasMaxLength(36) .IsFixedLength() .IsUnicode(false); } }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Configurations.Add(new UserProfileConfiguration()); }











