Applications

Welcome to My Blog and LINQ2SQL Performance Issues

Thanks for coming to my blog.  I’m a Software Engineering Consultant for Catapult Systems.  From time to time I will be posting whatever interesting programming related information here. 
 
This time I’ll be discussing .NET and LINQ2SQL and/or EntityFramework.
 
The LINQ2SQL DBML Visual creator allows you to build ORM objects that map to underlying tables with DISCRIMINATORS. 
 
Microsoft shows you how here!  Great feature!  Helps me easily build complex relationships easily.
 
It just so happens that on a previous project this feature was overused, to the tune of over 70+ inherited object types.
 
We ran into a performance issues with the first execution of a LINQ2SQL Query for that object per thread.
 
After much debugging, it seems that LINQ2SQL and Entity Framework both have this issue in dealing with Inheiritance Heirarachies bigger than 10 Objects.   It has nothing to do with building or executing the Queries, but on building the object type with all it’s inheritance.
 
 
There’s a ‘hacky’ way to address it, but it didn’t come out right.  I’ll go into that some other time.
 
The Moral of the story:  Don’t overuse Inheritance on Entity Framework with Inheritance.  It’s a known issue from Microsoft.
 

7 Comments

  1. bellayh May 11, 2011
  2. gamesef May 17, 2011
  3. moedbet May 21, 2011
  4. قصص اطفال February 3, 2012
  5. قصص اطفال February 3, 2012
  6. therapy July 27, 2012

Leave a Reply