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 7624735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:02:38+00:00 2026-05-31T05:02:38+00:00

I have an existing database, which I have been happily accessing using LINQtoSQL. Armed

  • 0

I have an existing database, which I have been happily accessing using LINQtoSQL. Armed with Sanderson’s MVC3 book I thought I’d have a crack at EF4.3, but am really fighting to get even basic functionality working.

Working with SQL 2008, VS2010, the folder architecture appears to be:

ABC.Domain.Abstract
ABC.Domain.Concrete
ABC.Domain.Concrete.ORM
ABC.Domain.Entities

Per examples, repository interfaces are abstract, actual repositories are concrete. Creating EDMX from the existing database puts that in the ORM folder and the Entities holds the classes I designed as part of the domain. So far so good.

However! I have not once persuaded the deceptively simple EfDbContext : DbContext class, with method to work…

public DbSet<ABC.Domain.Entities.Person> Person { get { return _context.Persons; }}

It complains about missing keys, that Person is not a entity class, that it cannot find the conceptual model, and so on.

  1. Considering I have a basic connectionstring in the web.config, why is not creating a model on the fly to do simple matching?

  2. Should the ORM folder exist, or should it simply be Concrete? (I have a .SQL subfolder for LINQtoSQL concret so it suits me to have .ORM but if it’s a flaw, let’s fix it).

  3. Should I have my homespun entities AND the automatically produced ones or just one set?
    The automatic ones inherit from EntityObject, mine are just POCO or POCO with complexTypes, but do not inherit from anything.

  4. What ties the home designed Domain.Entities.Person type to the Persons property of the Context?
    Sanderson’s book implies that the matching is implicit if properties are identical, which they are, but that does not do it.

  5. The app.config has an EF flavoured connection string in it, the web.config has a normal connection string in it. Which should I be using – assuming web.config at the moment – so do I delete app.config?

Your help is appreciated. Long time spent, no progress for some days now.

  • 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-31T05:02:42+00:00Added an answer on May 31, 2026 at 5:02 am

    What ties the home designed Domain.Entities.Person type to the Persons
    property of the Context?

    You seem to have a misunderstanding here. Your domain entities are the entities for the database. There aren’t two sets. If you actually want to have two sets of object classes (for whatever reason) you must write any mapping between the two manually. EF only knows about the classes which are part of the entity model.

    You should also – if you are using EF 4.3 – apply the DbContext Generator T4 template to the EDMX file. Do not work with EntityObject derived entities! It is not supported with DbContext. The generator will build a set of POCO classes and prepare a derived DbContext. This set of POCO classes are the entities the DbContext will only know about and they should be your only set of domain entities.

    The created DbContext will contain simple DbSet properties with automatic getters and setters…

    public DbSet<Person> People { get; set; }
    

    …and the Person class will be created as POCO as well.

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

Sidebar

Related Questions

I currently have an existing database and I am using the LINQtoSQL generator tool
I have been using Entity Framework 4.3 on an existing database and I have
I have an existing database with tables which each have 4 partitions (there are
I've been tasked to create a PHP app which accesses an existing PostgreSQL database.
I have an existing Access database which contains training records for employees. If an
I have been working with a project which is using grails / hibernate with
I have a existing MySQL database which has large number of tables. But the
I have an existing database with the table Transactions in it. I have added
I have an existing database of a film rental system. Each film has a
I have an existing database that has some testing data into and I'm interested

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.