Monthly Archives: March 2011

Configuring Database Initializers in a config file

Entity Framework 4.1 introduced the concept of database initializers as a way for your application or tests to perform some actions before your database is used for the first time. On the team blog and in demos we commonly show … Continue reading

Posted in Code First, Database Initializers, DbContext API, Entity Framework | Tagged , , , | 5 Comments

A More General Queryable Collection

In the last three posts we looked at an implementation of extra-lazy Count for EF 4.1 and how to reduce the Reflection cost of this implementation. However, when looking at LazyCountCollection it is fairly apparent that the same pattern can … Continue reading

Posted in Code First, DbContext API, Entity Framework | Tagged , , , , , , , | 3 Comments

LazyCountCollection with Better Performance

In my previous two posts I showed how to implement an extra-lazy Count property using EF 4.1. However, the code required that a lot of .NET Reflection happen for every entity returned by a query. The real-world performance impact of … Continue reading

Posted in Code First, DbContext API, Entity Framework | Tagged , , , , , , , , | 1 Comment

Extra-Lazy Collection Count with EF 4.1 (Part 2)

Using LazyCountCollection in a model In part 1 we setup all the infrastructure for implementing an extra-lazy Count property with EF 4.1—now let’s actually use it!

Posted in Code First, DbContext API, Entity Framework | Tagged , , , , , , | 6 Comments

Extra-Lazy Collection Count with EF 4.1 (Part 1)

Lazy loading Lazy loading of collections is the process whereby a collection of entities is automatically loaded from the database the first time that the collection property referring to the entities is accessed. Support for lazy loading was added to … Continue reading

Posted in Code First, DbContext API, Entity Framework | Tagged , , , , , , | Leave a comment

Why One Unicorn?

Microsoft has a tendency to come up with long convoluted names for products. (There are reasons for this…I hesitate to call them good reasons, but there are reasons nonetheless.) Back when we released the CTP4 version of Code First and DbContext the … Continue reading

Posted in Code First, DbContext API, Entity Framework | 3 Comments