Posts

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: https://www.nuget.org/packages/EFInteractiveViews Source code and documentation: https://github.com/moozzyk/EFInteractiveViews

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

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' 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 th...

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

Entityframework reverse POCO generator V2.4 released

Download:   here 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 .

Entityframework reverse POCO generator V2.1 released

Whats new in v2.1.0: Fixed bug if default constraint was not in expected format. Thanks to Filipe Fujiy . Now detects name clashes with C# keywords. Added "System." to DateTime.Now(), etc to prevent clashes with table field names. "Configuration" class names are now configurable as "Mapping", "Map", etc. Added support for Spatial.DbGeometry and Spatial.DbGeography. Thanks to  Simply Foolish and Jorge Bustos . Can now have custom collection type for Navigation Properties. "ObservableCollection" for example. Thanks to  Simply Foolish . Watch the video and Download at  visualstudiogallery

NServiceBus and encrypting strings in messages, plus how to remove NServiceBus from your messages library

Summary There are a few blog posts about using NServiceBus and encrypting strings using the WireEncryptedString type. However, you can also mark an ordinary string to be encrypted via configuration, which is more desirable as you can remove the dependancy from NServiceBus from your common Messages library. There is a gotcha though, if you ever mix the two, then WireEncryptedString go back to being unencrypted in MSMQ. This blog post explains how to easily fix this, and also how to remove NServiceBus from your Messages library. Win Win. Source code is avilable here . Compiling the project will automatically download packages via NuGet. Initial project setup Always have a separate Messages project to keep your messages in. In this example, the project is called Messages and contains the following class: using   NServiceBus ; namespace   Messages {      public   class   MyMessage  :  IMessage     { ...