c# Programming Glossary: modelbuilder.entity
Soft Delete Entity Framework Code First http://stackoverflow.com/questions/12698793/soft-delete-entity-framework-code-first override void OnModelCreating DbModelBuilder modelBuilder modelBuilder.Entity Foo .Map m m.Requires IsDeleted .HasValue false modelBuilder.Entity.. Foo .Map m m.Requires IsDeleted .HasValue false modelBuilder.Entity Bar .Map m m.Requires IsDeleted .HasValue false It's more complicated.. derived entities. Here 'Block' derives from 'Property' modelBuilder.Entity Property .Map Property m m.Requires Discriminator .HasValue..
Entity Framework Code First: decimal precision and scale http://stackoverflow.com/questions/3504660/entity-framework-code-first-decimal-precision-and-scale System.Data.Entity.DbModelBuilder modelBuilder modelBuilder.Entity Class .Property object object.property .HasPrecision 12 10 base.OnModelCreating..
EF4 Code First: how to add a relationship without adding a navigation property http://stackoverflow.com/questions/5217441/ef4-code-first-how-to-add-a-relationship-without-adding-a-navigation-property modelBuilder base.OnModelCreating modelBuilder modelBuilder.Entity User .HasRequired r r.Role .WithMany .HasForeignKey r r.RoleId.. .HasRequired r r.Role .WithMany .HasForeignKey r r.RoleId modelBuilder.Entity Right .HasRequired r r.Role .WithMany .HasForeignKey r r.RoleId..
Does Entity Framework 4 Code First have support for identity generators like NHibernate? http://stackoverflow.com/questions/5275306/does-entity-framework-4-code-first-have-support-for-identity-generators-like-nhi modelBuilder base.OnModelCreating modelBuilder modelBuilder.Entity MyEntity .HasKey e e.Id Turn off autogeneration in database.. .HasKey e e.Id Turn off autogeneration in database modelBuilder.Entity MyEntity .Property e e.Id .HasDatabaseGeneratedOption HasDatabaseGeneratedOption.None..
Entity Framework Code First - two Foreign Keys from same table http://stackoverflow.com/questions/5559043/entity-framework-code-first-two-foreign-keys-from-same-table override void OnModelCreating DbModelBuilder modelBuilder modelBuilder.Entity Match .HasRequired m m.HomeTeam .WithMany t t.HomeMatches.. .HasForeignKey m m.HomeTeamId .WillCascadeOnDelete false modelBuilder.Entity Match .HasRequired m m.GuestTeam .WithMany t t.AwayMatches..
Navigation Property without Declaring Foreign Key http://stackoverflow.com/questions/5691780/navigation-property-without-declaring-foreign-key from a semantic viewpoint. So in Fluent API you want this modelBuilder.Entity User .HasRequired u u.Creator .WithMany modelBuilder.Entity.. User .HasRequired u u.Creator .WithMany modelBuilder.Entity User .HasRequired u u.Modifier .WithMany Because a User can..
What does principal end of an association means in 1:1 relationship in Entity framework http://stackoverflow.com/questions/6531671/what-does-principal-end-of-an-association-means-in-11-relationship-in-entity-fr BooId get set public Foo Foo get set Or fluent mapping modelBuilder.Entity Foo .HasOptional f f.Boo .WithRequired s s.Foo share improve..
Entity Framework 4.3 - TPH mapping and migration error http://stackoverflow.com/questions/9499702/entity-framework-4-3-tph-mapping-and-migration-error in 4.1. and 4.2. Something like this pattern modelBuilder.Entity Parent .Map Foo ... .Map Bar ... This doesn't work in 4.3 and.. for that entity. So a pattern something like this modelBuilder.Entity Foo .Map Foo ... modelBuilder.Entity Bar .Map Bar ... Taking.. something like this modelBuilder.Entity Foo .Map Foo ... modelBuilder.Entity Bar .Map Bar ... Taking your case specifically this should work..
|