Wednesday, 10 December 2014

Pregenerated Views for Entity Framework 6

When Entity Framework starts, it first builds a set of internal views that describes the database in an agnostic way. All further processing (queries, updates etc.) EF does, is performed against these views. Generating views however can be costly and will impact start up time of the application.
The startup time for a 1000 table context can be in excess of minutes.

However, this can be worked around by generating views at design time by using EFInteractiveViews Nuget Package. It allows you to pre-generate and save the generated views to a file. Neat!

Install the Nuget package:
Source code and documentation:

Thursday, 7 August 2014

I'm in MSDN Magazine this month :-)

I am in the August 2014 edition of MSDN Magasine, Data Points section.
The article is written by Julie Lerman on the EntityFramework Reverse POCO Generator I created.
MSDN link:

Thursday, 10 July 2014

SQL Datetime comparison gotcha

I discovered a problem when inserting data in our database. My insert statement was checking for the existence of data in the WHERE clause to prevent duplicate data being inserted. None was detected, and the INSERT happend. However, the unique constraint rejected the data as it already existed in the database.

The problem was the data to be inserted was DATETIMEOFFSET(2) and the database field being inserted into was DATETIME.

To show you want I'm talking about, run the following:

DECLARE @dt  DATETIME          = '2014-07-07 09:49:33.000';
DECLARE @dto DATETIMEOFFSET(2) = '2014-07-07 09:49:33.00 +07:00';

PRINT CASE WHEN @dt = @dto THEN 'Equals matches'
           ELSE 'Equals does not match'

PRINT CASE WHEN @dt = CAST(@dto AS DATETIME) THEN 'Cast matches'
           ELSE 'Cast does not match'

Results in the following:
Equals does not match
Cast matches

The comparison (=) operator does not perform the same way the implicit cast does if you insert the data. The cast/convert operator actually throws away the offset! Madness.

Tuesday, 1 April 2014

A new tutorial video

I have released a new and updated tutorial video for Entity Framework Reverse POCO generator.
It is available to stream or download at:

Wednesday, 5 March 2014

Entityframework reverse POCO generator V2.4 released

Download: here

Whats new in v2.4.0
  1. Removed use of System.Data.Entity.DLL from the installation template as it is no longer required for EF 6.
  2. Moved spatial types from System.Data.Spatial to System.Data.Entity.Spatial for EF 6.
  3. Singular names and camel casing configuration were accidentally combined by using the UseCamelCase boolean. Thanks to Rune Gulbrandsen.
  4. Added new flag IncludeComments. This controls the generation of comments in the output.
  5. Fixed bug in constructor where a UNIQUEIDENTIFIER column had default value. Thanks to gonglei.