Changing EF’s default connection factory from LocalDb to Sql Server

When you create a new project that makes use of Entity Framework 5, you’ll notice how it uses LocalDb by default now. But let’s assume you have a fully working instance of Sql Server that you wish to work against instead of LocalDb. How do you tell EF to use it? Simple, modify your application’s…


Quick tip for concurrency when using Entity Framework

Entity Framework does a great job at simplifying the way we interact with storage. Sometimes we need to use parallelism to speed up the completion of a task. This is usually done by means of multithreading (note: always prefer to use a new context per request, instead of a context per thread) or with async. In…


Quick tip for large applications using Entity Framework Code-First

Quick tip. When using Entity Framework and its Code-First way of working your code to configure the entities might grow very large. When that’s the case, it might be possible to see under a profiler that the JIT’er is taking a large amount of time just to get you started. There are two ways to…


Entity Framework performance whitepaper

The Entity Framework team first published the EF performance considerations whitepaper for EF5 back in April 2012. In May 2014 we updated it to cover and compare EF 4, 5 and 6. We highly encourage people to move up to the latest version of Entity Framework 6 since that’s where most of our performance investment…


Debugging startup crash of a universal app

You’ll need a few tools: NP Profiler Make sure to select the Store App version of NP WinDbg If you have the Windows Developer Kit, you already have it SOSEX This is an extension to analyze managed stacks in WinDbg   Start the NP profiler and select your app. Select “Run under…


MVP Stream (in Spanish)

Matías Quaranta, an MVP from Argentina, created this amazing tool that aggregates blog content from a multitude of Spanish-speaking MVPs from Latin America and Spain. Highly recommended resource for Spanish-speaking developers. Make sure you follow @mvpstreams on twitter too!


How to get the EDMX metadata from a Code First model (and why you need it)

Entity Framework provides a very good experience with its Code First development model. In it you can define classes and use them as POCO entities (Plain Old CLR Objects). For example, consider the following model:      public class Blog     {         public int BlogId { get; set; }         public string Name { get;…


Wrapping IQueryable objects for testability

In some cases, testing IQueryable objects can be difficult. They are hard to mock and the LINQ magic that’s happening under the hood is usually hidden from the programmer. It would be convenient to wrap an IQueryable around a mockable container so that our code can be tested even when the actual data sources may not be…


Override bitlocker PIN entry during reboot

One of my machines has bitlocker enabed but doesn’t have a TPM chip. This translates into an annoying but secure PIN or password entry every time a reboot is required. This is okay when I’m near the computer but sometimes I have to reboot while being remote. WARNING: this might leave your computer vulnerable. You’re…