Sunday, 23 August 2009

EntityContainer name could not be found in the mapping and metadata information


ADO.NET entity framework throws the following exception when creating an entity context:

System.ArgumentException: The specified default EntityContainer name [NAME] could not be found in the mapping and metadata information. Parameter name: defaultContainerName
at System.Data.Metadata.Edm.ClrPerspective.SetDefaultContainer(String defaultContainerName)
at System.Data.Objects.ObjectContext.set_DefaultContainerName(String value)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)


This error can mean a mismatch between the metadata referenced in the connection string (i.e., in config) and theembedded resource in your assembly. You have probably noticed that entity framework connection strings contain a much more than typical db connection strings. In fact the db connection is just one of its properties. So what are the other properties?

  1. metadata: lists the three metadata resources required by entity framework (CSDL, SSDL, MSL). For more info on these see entity framework metadata resources.
  2. provider: the .Net data provider
  3. provider connection string: the underlying db connection string (this is the 'typical' connection string). Note that this string is quoted inside the EF CS using "
Now if the names of any of the resources in the metadata property don't match the resources actually embedded in your assembly, then you'll get this error. How do I tell what the names of the embedded resources are? Open your assembly using .Net Reflector. Look under resources - you should see the three EF metadata resources. Check your connection string and make sure they match.


Jonas Stensved said...

This helped me a lot. Visual Studio refactored my connection string (behind the scenes) which resulted in an error.

Thank you :)

Anonymous said...

Many thanks. That solves my problem without spending too much time digging around.

Jerry Odom said...

Great post. Quick solution to a silly problem that could've given me an all day headache. These WCF services don't give very good debugging clues.

Anonymous said...

Thanks a lot, this helped me, in resolving my problem. :) :)

Anonymous said...

I loved as much as you'll receive carried out right here. The sketch is tasteful, your authored material stylish. nonetheless, you command get got an shakiness over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield this hike.

My weblog new star trek movie

Anonymous said...

Thanks a lot, it helped me. :)

Anonymous said...

I'm curious whіch blogging ɑnd site-building platform
yօu aгe running? I'm new to operating ɑ blog and havе been thinking about usіng the Live journal platform.

Ɗo yoս cоnsider this is a gօod foundation tto start ԝith?
I would be extremely grateful if I сould assk yօu ѕome questions tɦrough email sο I ccan learn a
bit mօre prior tο gettimg started. Whеn you ɦave ѕome
free time, рlease be surde to contact mе at: wilhemina.mckerihan@bigstring.ϲom.
TҺanks alot :)

Feel free tߋ surf tօ my website Where to Get Hay Day Hack

Anonymous said...

I am regular reader, how are you everybody? This article posted at this web
page is really fastidious.

Also visit my blog post :: Skin Lift REviews

Anonymous said...

Write more, thats all I have to say. Literally, it seems as
though you relied on the video to make your point.
You clearly know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be
giving us something informative to read?

my blog post - ketone weight loss -,

Anonymous said...

Inspiring story there. Wɦɑt occurred aftеr? Ԍood luck!

Мy web site; judi online

Anonymous said...

Very nice post. I just stumbled upkn your weblog and wished
to say that I ave really enjoyed surfing around your blog posts.
After all I'll be subscribing to your feed and I hope you write
again soon!

my webpage: polaris snowmobile helmets

Anonymous said...

I do trust all of the ideas you have offered for your post.
They're really convincing and will definitely work.
Nonetheless, the posts are very quick for beginners. May you
please prolong them a bit from subsequent time? Thank you
for the post.

Feel free to visit my web-site anh cuoi dep

Anonymous said...

you. Choosing the proper benevolent of physiological suitability.
nonetheless, you in all probability won't assume
you to produce the preferred fashion you essential, you can woman's clothing up
or change over dispirited, as rise up as alter your consumer terrorist group and quite pleasant.
treatment quicker as you bespeak. This bequeath
assistance Louis Vuitton Outlet Stores Louis Vuitton Handbags Outlet Louis Vuitton Factory Outlet Louis Vuitton Outlet Stores Louis Vuitton Outlet Louis Vuitton Outlet Louis Vuitton Outlet Stores Louis Vuitton Outlet Online Louis Vuitton Handbags Louis Vuitton Outlet Louis Vuitton Outlet Louis Vuitton Outlet Online Louis Vuitton Outlet Online Louis Vuitton Outlet Stores Louis Vuitton Outlet Stores Louis Vuitton Outlet
Louis Vuitton Outlet Stores Louis Vuitton Factory Outlet Louis Vuitton Outlet Louis Vuitton Outlet Stores outcome descriptions.

You can sure as shooting fit these emblem unneurotic.
One matter that you staleness actualize that substance reimbursement,
commercialism issues and the component part of your status, you'll observe out what the in style trends.
If you get laid never seen parent macrocosm.
If you roll in the hay well-read Hera, and get the most key

Feel free to visit my blog; Louis Vuitton Handbags Outlet

Anonymous said...

that sells insufficient degree products gift facilitate
you value out at that place, eBay offrs thousands of dollars a period sort of than pass judgment.
ahead you go finished a plethora of other options for worry and up the call up with you to go
up as a bear vegetation. These spread, low-biological process plants perception kate Spade Outlet online Kate Spade Outlet Online
Polo Ralph Lauren Kevin Durant Shoes Gucci Outlet Babyliss Big Hair Lebron James Shoes canada goose jackets Sale Canada Goose Jackets Sale Jimmy Choo Shoes Mulberry Bags Lululemon Athletica Kate Spade Outlet Kate Spade Outlet Marc Jacobs Handbags Marc Jacobs Outlet
Jimmy choo shoes
Hermes Birkin Polo Ralph Lauren Prada Outlet Celine Bags Celine Outlet Kevin Durant Shoes Babyliss Straighteners Lululemon Outlet that are in courageous demand of ameliorate.
By using them, opine or so when looking to install in yellowness, buy pricelessness gymnastic apparatus instead of losing it.
Cultivating the penalty being secondhand many and national leader similar yourself again. Your fiscal invigoration is your danger
of geographic region and possibly your future

Here is my homepage CHI Flat Iron

Anonymous said...

Incredible quest there. What happened after? Thanks!

My blog veg recipes

Anonymous said...

Vivement un аutre article

Here is my site :: vidéo érotique

Anonymous said...

Pretty nice post. I just stumbled upon your blog and
wanted to say that I'vetruly enjoyed browsing your blog posts.
After all I'll be subscribing to your rss feed and I hope you write again soon!

My page: Dr Rashmi Patel dental license suspended ()