EF6: Writing Your Own Code First Migration Operations

Migrations provides a set of strongly typed APIs for performing common operation, for example CreateIndex("dbo.Blogs", "Url"). We also provide a method that allows you to run arbitrary SQL when you want to do something that isn’t supported by the API, for example Sql("GRANT SELECT ON dbo.Blogs to guest"). There are some disadvantages to the Sql … Continue reading EF6: Writing Your Own Code First Migration Operations

Extending And Customizing Code First Models – Part 2 of 2

Here is the scenario, your company ships a library or application that contains a Code First model for accessing the database. Your customers want to extend this model to include extra types/properties to meet their specific business needs. These types/properties will be stored in additional tables/columns in the application database. In Part 1 we looked at … Continue reading Extending And Customizing Code First Models – Part 2 of 2

Extending and Customizing Code First Models – Part 1 of 2

Here is the scenario, your company ships a library or application that contains a Code First model for accessing the database. Your customers want to extend this model to include extra types/properties to meet their specific business needs. These types/properties will be stored in additional tables/columns in the application database. In this post I’ll walk … Continue reading Extending and Customizing Code First Models – Part 1 of 2

EF6 Code First: Mapping All Private Properties Using Custom Conventions

A while back I blogged about mapping to private properties with Code First. The approach shown in that post works with EF4.1 onwards but it requires you to explicitly configure every private property that you want included in your model. That’s going to get tiresome if you have a big model and want all private … Continue reading EF6 Code First: Mapping All Private Properties Using Custom Conventions

Customizing ‘Reverse Engineer Code First’ in the EF Power Tools

Beta 2 of the Entity Framework Power Tools was recently released. By far the most popular feature out of these power tools is the ability to reverse engineer a Code First model from an existing database. Admittedly ‘Code First’ wasn’t the best choice of names… Code First is really just a code-based alternate to the … Continue reading Customizing ‘Reverse Engineer Code First’ in the EF Power Tools