Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1957
  • Last Modified:

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

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
Greg_L_WER
Asked:
Greg_L_WER
  • 4
  • 3
1 Solution
 
Bob LearnedCommented:
Does the connection string in the config file look correct?
0
 
Greg_L_WERAuthor Commented:
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
 
Bob LearnedCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Greg_L_WERAuthor Commented:
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
 
Bob LearnedCommented:
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
 
Greg_L_WERAuthor Commented:
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
 
Greg_L_WERAuthor Commented:
Other suggestions didn't solve the issue... need to close out this question
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now