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: https://www.nuget.org/packages/EFInteractiveViews
Source code and documentation: https://github.com/moozzyk/EFInteractiveViews
Pluralsight & Packt Author, Director, CTO, Software Architect, Team leader, Tutor, Speaker, Software Developer. I like to make fast scalable things using C# and SQL Server.
Wednesday 10 December 2014
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: http://msdn.microsoft.com/en-us/magazine/dn759438.aspx
The article is written by Julie Lerman on the EntityFramework Reverse POCO Generator I created.
MSDN link: http://msdn.microsoft.com/en-us/magazine/dn759438.aspx
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:
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.
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' END PRINT CASE WHEN @dt = CAST(@dto AS DATETIME) THEN 'Cast matches' ELSE 'Cast does not match' END
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: www.reversepoco.com
It is available to stream or download at: www.reversepoco.com
Wednesday 5 March 2014
Entityframework reverse POCO generator V2.4 released
Download: here
Whats new in v2.4.0
Whats new in v2.4.0
- Removed use of System.Data.Entity.DLL from the installation template as it is no longer required for EF 6.
- Moved spatial types from System.Data.Spatial to System.Data.Entity.Spatial for EF 6.
- Singular names and camel casing configuration were accidentally combined by using the UseCamelCase boolean. Thanks to Rune Gulbrandsen.
- Added new flag IncludeComments. This controls the generation of comments in the output.
- Fixed bug in constructor where a UNIQUEIDENTIFIER column had default value. Thanks to gonglei.
Subscribe to:
Posts (Atom)