The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,465 other followers

Archive for April 5th, 2011

Recommended blog post: Favorite C# Idioms | Blue Onion Software

Posted by jpluimers on 2011/04/05

While browsing for some less used but useful C# features, I came across a great post by Michael (Mike) Ward from Blue Onion Software on Favorite C# Idioms based on the great Hidden Features of C# thread on StackOverflow.

Mike starts with

There’s a great post on Stackoverflow about hidden features in C#. I prefer to think of these as idioms rather than hidden features since most are actually documented. Here are my favorites.

Then he continues with some nice examples of C# idioms.

Recommended reading!

–jeroen

via Favorite C# Idioms | Blue Onion Software.

Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Development, Software Development | Leave a Comment »

Entity Framework 4 “Error 3004: Problem in mapping fragments starting at line” means you must generate your DB from your model first (Stack Overflow)

Posted by jpluimers on 2011/04/05

Entity Framework 4 is nice, but has very confusing  error messages.

Maybe it is just me, but getting a feel for what each error message means, and how to cure the underlying mistake(s) is time consuming.

For instance, it took me quite a while to find out why this error occurred during a project build:

Error 3004: Problem in mapping fragments starting at line 569: No mapping specified for properties MyEntity.MyValue in Set MyEntities. An Entity with Key (PK) will not round-trip when: Entity is type [MyEntities.MyEntity]

The solution was simple, I had forgotten to manually perform the “Generate Database from Model…” step before building my solution and was glad I found it in this Stack Overflow answer:

Have since discovered that after I add/change/delete properties on my entities I must “Generate Database from Model” before I compile otherwise I get 3004 mapping errors.

Note that this generation is always a manual step; I haven’t found a way to automate that (if you have found a way: please add a comment below).

–jeroen

via: .net – Entity Framework 4 mapping fragment error when adding new entity scalar – Stack Overflow.

Posted in .NET, Development, EF Entity Framework, Software Development | 5 Comments »

 
%d bloggers like this: