Solved

The specified default EntityContainer name 'Automation_CSRSEntities' could not be found in the mapping and metadata information.

Posted on 2013-12-30
7
1,682 Views
Last Modified: 2014-05-11
Since updating my edmx file with a few small table changes I've been receiving this error:

The specified default EntityContainer name 'Automation_CSRSEntities' could not be found in the mapping and metadata information.
Parameter name: defaultContainerName

I've tried deleting all the edmx files and recreating them from scratch but unfortunately this has not solved the issue.  So far I've not had any luck finding any relevant information in my searches.  We're using SQL2012.  Any help would be appreciated.

Thanks,
Greg


It breaks at line 52

Source Error:

Line 50:         /// Initialize a new Automation_CSRSEntities object.
Line 51:         /// </summary>
Line 52:         public Automation_CSRSEntities(EntityConnection connection) : base(connection, "Automation_CSRSEntities")
Line 53:         {
Line 54:             this.ContextOptions.LazyLoadingEnabled = true;

Open in new window



Stack Trace:

[ArgumentException: The specified default EntityContainer name 'Automation_CSRSEntities' could not be found in the mapping and metadata information.
Parameter name: defaultContainerName]
   System.Data.Metadata.Edm.ClrPerspective.SetDefaultContainer(String defaultContainerName) +7893705
   System.Data.Objects.ObjectContext.set_DefaultContainerName(String value) +69
   System.Data.Objects.ObjectContext..ctor(EntityConnection connection, String defaultContainerName) +75
   Automation_CSRSModel.Automation_CSRSEntities..ctor(EntityConnection connection) in d:\eS\App_Code\Automation_CSRS.Designer.cs:52
   OrderProcessHistoryRepo..ctor(EntityConnection con) in d:\eS\App_Code\Repo\OrderProcessHistoryRepo.cs:25
   _sharedControls__Automation_autoRightFaxUploader.btnRightFaxCompleted_Click(Object sender, EventArgs e) in d:\eS\_sharedControls\_Automation\autoRightFaxUploader.ascx.cs:144
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9552874
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
0
Comment
Question by:Greg_L_WER
  • 4
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Does the connection string in the config file look correct?
0
 

Author Comment

by:Greg_L_WER
Comment Utility
Connection string should be fine... I've removed it and let the edmx creation recreate it in the web.config.  I didn't make any changes to it...

<add name="Automation_CSRSEntities" connectionString="metadata=res://*/App_Code.Automation_CSRS.csdl|res://*/App_Code.Automation_CSRS.ssdl|res://*/App_Code.Automation_CSRS.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=******;initial catalog=******;persist security info=True;user id=******;password=******;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
EntityContainer name could not be found in the mapping and metadata information
http://netsideout.blogspot.com/2009/08/entitycontainer-name-could-not-be-found.html

This error can mean a mismatch between the metadata referenced in the connection string (i.e., in config) and the embedded resource in your assembly.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Greg_L_WER
Comment Utility
Thanks... I'd come across that blog earlier and installed .NET Reflector 8.  Doesn't appear to be any decent help documentation on it.  Any idea where do I even begin to look?  

Thanks,
Greg
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Greg,

If you add a new ADO Entity Data Model to a project, you get this:

1) A generator data context file (.edmx extension)

2) A connection string in the application configuration file (app.config or web.config depending on application type).

Here is an example:

I added a new ADO Entity Data Model pointing to an SQL Server Database File (Music.mdf).

Connection string in app.config:

<connectionStrings>
  <add name="MusicEntities"
     connectionString="metadata=res://*/Music.csdl|res://*/Music.ssdl|res://*/Music.msl;
        provider=System.Data.SqlClient;
        provider connection string='data source=(LocalDB)\v11.0;
                attachdbfilename=Music.mdf';
        integrated security=True;
        connect timeout=30;
        MultipleActiveResultSets=True;
        App=EntityFramework'"  
     providerName="System.Data.EntityClient" />
  </connectionStrings>


The connection string starts with 3 different metadata properties:

Conceptual schema definition language (CSDL)
Store schema definition language (SSDL)
Mapping specification language (MSL)

If you open the .edmx file (an XML file), you will see different portions.

1. SSDL Content



    <!-- SSDL content -->
    <edmx:StorageModels>
      <Schema Namespace="MusicModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2008" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityType Name="Album">
          <Key>
            <PropertyRef Name="AlbumId" />
          </Key>
...


2. CSDL Content


  <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="MusicModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
...


3. MSL Mapping (C - S Mapping)


  <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
...

 
The resource names should match those in the connection string:

Music.csdl
Music.ssdl
Music.msl

I can use this C# code to get the manifest resource names from the assembly:

  var assembly = System.Reflection.Assembly.GetExecutingAssembly();
            var resourceNames = assembly.GetManifestResourceNames();

            Console.WriteLine(resourceNames);

Open in new window


Here is the result of the Console.WriteLine:

Debugging Output for Assembly.GetManifestResourceNames
0
 

Accepted Solution

by:
Greg_L_WER earned 0 total points
Comment Utility
Unfortunately this didn't solve my issue... I ended up reverting back to an earlier version of my edmx file and restarted my changes at that point.
0
 

Author Closing Comment

by:Greg_L_WER
Comment Utility
Other suggestions didn't solve the issue... need to close out this question
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now