public BaseEntityRootMap()
 {
     ContractUtility.Requires <ArgumentNullException>(IDColumnName.IsNotNullOrWhiteSpace(), "IDColumnName cannot be null or empty.");
     ExtendKeyIDWithOtherConfigurations(HasKey(p => p.Id));
     ExtendPropertyIDWithOtherConfigurations(Property(p => p.Id).HasColumnName(IDColumnName).HasDatabaseGeneratedOption(DbIdGenerationOption));
     SetEntitySpecificProperties();
     ToTable(TableName);
 }
Beispiel #2
0
        public virtual void Configure(EntityTypeBuilder <TEntity> builder)
        {
            ContractUtility.Requires <ArgumentNullException>(IDColumnName.IsNotNullOrWhiteSpace(), "IDColumnName cannot be null or empty.");
            builder.HasKey(p => p.Id);
            var idProperty = builder.Property(p => p.Id).HasColumnName(IDColumnName);

            if (DbIdGenerationOption == DatabaseGeneratedOption.Identity)
            {
                idProperty.ValueGeneratedOnAdd();
            }
            SetEntitySpecificProperties(builder);
            builder.ToTable <TEntity>(TableName);
        }