Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 642767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:12:32+00:00 2026-05-13T21:12:32+00:00

I just installed the POCO Template for EF4. I have a single entity in

  • 0

I just installed the POCO Template for EF4. I have a single entity in my model, AnnouncementText, and the T4 files seem to be properly generated. Attempting to access this new entity is throwing the following error when I access the auto-generated property MyObjectContext.AnnouncementTexts:

InvalidOperationException: Mapping and metadata information could not be found for EntityType ‘MyNamespace.AnnouncementText’.

The properties on the AnnouncementText POCO seem to match up with the columns in the database, and I haven’t changed any of the auto-generated code.

The stack trace is:

   at System.Data.Objects.ObjectContext.GetTypeUsage(Type entityCLRType)
   at System.Data.Objects.ObjectContext.GetEntitySetForNameAndType(String entitySetName, Type entityCLRType, String exceptionParameterName)
   at System.Data.Objects.ObjectContext.CreateObjectSet[TEntity](String entitySetName)
   at MyNamespace.MyObjectContext.get_AnnouncementTexts() in C:\<snip>\MyObjectContext.Context.cs:line 65
   at MyNamespace.Class1.Main() in C:\<snip>\Class1.cs:line 14

If I delete the .tt files from the solution and enable code generation on the model, I am able to access the property without issue.

Here’s my code, in case that might help:

using (var context = new MyObjectContext())
   foreach (var at in context.AnnouncementTexts)
      Console.WriteLine(at.Title);

Any ideas on what might be wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:12:33+00:00Added an answer on May 13, 2026 at 9:12 pm

    I recently ran into this same error again while moving my EDMX file to a new location in the solution. Apparently, there are a couple of different namespaces when dealing with EDMX files. There is the namespace you enter via the wizard when creating the initial EDMX file (N1), another that appears in the SSDL which looks something like this (N2):

    <Schema Namespace="..." ..
    

    Then there’s the namespace of the generated code which may (optionally) be specified in the designer (N3), and finally there are the hidden namespaces of the resources that are compiled in to your final assembly (N4).

    From what I can tell, namespace N2 is only really relevant inside the SSDL. I believe this namespace starts off as N1 – the one you initially enter in the wizard.

    Similarly, namespace N3 is only relevant in the way C# namespaces usually are.

    Here’s the problematic part. Category N4 namespaces are a function of the directory in which your EDMX resides (relative to your project directory). You might think, So what? It turns out those namespaces are also referenced in your App.config file! Specifically, look for a part like this:

    connectionString="metadata=res://*/Database.Master.csdl|...
    

    That portion reading “Database.Master.csdl” is the name of your CSDL resource. If those resource names get out of sync, you’ll receive an error like the one above, or perhaps:

    The specified default EntityContainer name ‘[name]’ could not be found in the mapping and metadata information.

    The simple solution is to alter your App.config to specify the correct resource name for each part of your EF mapping (CSDL, SSDL, and MSL). If you’re not sure exactly what those names are, check out your compiled assembly’s resources in ILSpy or dotPeek.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just installed Python 2.7.3 on a Windows7 machine. How do I get .py files
Just installed EE everything seems clear however I can't seem to find a solution
Just installed 2010 Express Edition and I cannot see Preprocess t4 template as an
I just installed AnkhSVN to have subversion support from within Visual Studio 2010. I
Just installed Nagios 3.2 and have it monitoring 4 or 5 windows hosts as
Just installed Ubuntu 10.10. Previously I had Ubuntu 10.04. I have a shared partition
I just installed apache (1.3.33) via cygwin running on Windows XP. I have the
Just installed django-db-log module and trying to make it work properly. 'python manage.py syncdb'
Just installed phonegap ios-sdk now I can see PhoneGap template in XCode v4.2. But
Just installed nodeJS and NPM and nodesupervisor via Terminal in OS 10.5.8. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.