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

  • Home
  • SEARCH
  • 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 6651915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:04:07+00:00 2026-05-26T01:04:07+00:00

I feel like I’m missing some basic setup step here, but I’ve been wading

  • 0

I feel like I’m missing some basic setup step here, but I’ve been wading through forum posts, blog articles, and videos for hours and keep having the same problem, so I figure it’s time to post.

The error I’m getting is:
Mapping and metadata information could not be found for EntityType ‘qTrade.BusinessLayer.Domain.Model.Audit.LoanPool’.

I’ve got an Entity Model file called Audit.edmx that has code generation turned off. In there I generated an Entity from the database for this table (pasted from the create script, LoanPoolAuditId is the Primary Key):

CREATE TABLE [Audit].[LoanPool](
    [Type] [char](1) NULL,
    [TableName] [varchar](128) NULL,
    [PK] [varchar](1000) NULL,
    [FieldName] [varchar](128) NULL,
    [OldValue] [varchar](1000) NULL,
    [NewValue] [varchar](1000) NULL,
    [UpdateDate] [datetime] NULL,
    [UserName] [varchar](128) NULL,
    [CommonID] [int] NULL,
    [LoanPoolAuditId] [int] IDENTITY(1,1) NOT NULL,

I’ve got a class I created to be a POCO elsewhere in the same project

public class LoanPool
{
    public int CommonID { get; set; }
    public string FieldName { get; set; }
    public int LoanPoolAuditId { get; set; }
    public string NewValue { get; set; }
    public string OldValue { get; set; }
    public string PK { get; set; }
    public string TableName { get; set; }
    public char Type { get; set; }
    public DateTime UpdateDate { get; set; }
    public string UserName { get; set; }
 }

And I’ve got the context class

public class AuditContext : ObjectContext
{
    public AuditContext()
        : base("name=AuditEntities", "AuditEntities")
    {
        this.LoanPools = CreateObjectSet<LoanPool>();
    }

    public ObjectSet<LoanPool> LoanPools { get; set; }        
}

Heres the connection string for reference

"metadata=res://*/EntityModels.Audit.csdl|res://*/EntityModels.Audit.ssdl|res://*/EntityModels.Audit.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=serverName;initial catalog=databaseName;persist security info=True;user id=*SNIP*;password=*SNIP*;multipleactiveresultsets=True;App=EntityFramework&quot;"

Very simple (or so I thought).

When I go to instantiate an instance of the context I get the aforementioned error on the CreateObjectSet step.

Any suggestions would be greatly appreciated, even if they are simple or obvious, this is my first time using POCOs so there’s a good chance I missed something.

Go figure I had no trouble using code-first in a different project 😛

Thanks

  • 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-26T01:04:07+00:00Added an answer on May 26, 2026 at 1:04 am

    We generally recommend using DbContext as the primary means of operating with anything EF 4.1 or beyond. In this case you would need to get rid of your existing .edmx and modify your AuditContext as follows:

    public class AuditContext : DbContext
    {
        public DbSet<LoanPool> LoanPools { get; set; }
    }
    

    You can also see the corresponding walkthrough on the official blog here: http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-code-first-walkthrough.aspx. Also, you will need to put the [Key] attribute on LoanPoolAuditId as it does not conform to the expected conventions. That’s also mentioned in the blog post.

    HTH,
    Mark

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

Sidebar

Related Questions

I feel like I'm just missing an environmental variable here, but is there anyway
I feel like I'm missing an obvious point here, but let's say I'm working
I feel like I'm missing something here, but I have this datagrid which when
I feel like I'm missing something pretty basic, but I can't seem to figure
I feel like a fool, but here goes: public interface IHasErrorController{ ErrorController ErrorController {
I feel like I should know this, but I haven't been able to figure
I feel like I'm re-inventing the wheel here, but I need to find a
I feel like this is a dumb question and I'm missing something, but I
I feel like I am just missing a simple property, but can you set
I feel like I should know this but I've been stumped for hours now

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.