Quantcast
Channel: Remondo » code first
Browsing all 10 articles
Browse latest View live

Simple Entity Framework and Code First example

I played around with a feature of Entity Framework; Code First. The concept is creating a data model from POCO – the Plain Old CLR Objects we use and love. Before you can do this you need to install...

View Article



Recreate tables when a Code First class changes

If you want to automatically recreate the database if your Code First model changes in an asp.net application, add the following code to the Application_Start in global.asax.cs. Call...

View Article

Code First Fluent API Entity Framework Model Creation

Since Entity Framework 4.1 we can use the Code First Fluent API to specify how our database gets created, effectively overriding the default settings. This is also possible with data annotations, but...

View Article

Entity Framework Code First Data Annotations

In the previous post we explored the use of the Entity Framework Code First Fluent API to configure properties and specify how the corresponding database is created. You can do this also by using data...

View Article

Entity Framework Code First Database Creation Strategies

Lets talk strategy for a moment. By default the entity framework uses a database creation strategy called CreateDatabaseIfNotExists. As the name implies this database initializer only creates the...

View Article


Code First Fluent API Entity Type Configuration

Entity Framework let us use the Code First Fluent API in the DbContext to configure how your entities are created. This is done by using the modelbuilder in an override of the OnModelCreate method as...

View Article

Entity Framework Concurrency Checking with Timestamp

Using a Timestamp column for optimistic concurrency control is quite a common practice in the SQL realm. While doing an insert, update or delete operation the database checks the Timestamp to see if...

View Article

Entity Framework Add Remove Attach and Detach

The DbContext of Entity Framework lets us add, remove, attach and detach entities to and from it. Calling SaveChanges on the DbContext the Entity Framework performs different actions on entities...

View Article


Entity Framework Code First Migrations Example

Before Entity Framework version 4.3 we mostly used one of three database creation strategies with Code First. The default database initializer is CreateDatabaseIfNotExists. If you created a database...

View Article


Entity Framework Code First Migrations Database Initializer

In the previous example we enabled Entity Framework Code First Migrations and upgraded the database manually each time if needed. It’s also possible to make this happen automatically, either directly...

View Article
Browsing all 10 articles
Browse latest View live




Latest Images