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

The Archive Base Latest Questions

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

I’m using EF4 and I’ve got two entities that I wish to map to

  • 0

I’m using EF4 and I’ve got two entities that I wish to map to the same POCO. I’m not sure how I can do this.

Entity 1 → Foo (this represents a table FOO in the db)
POCO → Foo

Entity 2 → FooView (this represents a view FooView in the db)
POCO → Foo

I understand that I need to do something like

IObjectSet<Foo> _foos = CreateObjectSet<Foo>();

// Note spelling of the Entity.
IObjectSet<Foo> _foosView = CreateObjectSet<Foo>("FooViews"); 

But when i try this, it does compile, but it fails with the following exception:

System.ArgumentException:
System.ArgumentException: The specified entity type, ‘MyProject.Core.Foo’,
does not match the type ‘EntityFramework.SqlServerModel.FoosView’
from the EntitySet ‘FoosViews’.

Any suggestions?

  • 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-13T13:12:22+00:00Added an answer on May 13, 2026 at 1:12 pm
    • How to: Define a Model with Multiple Entity Sets per Type
    • How to: Add an Object to a Specific Entity Set

    Here is a checklist of things to look for:

    1. Your Storage Model should have:
      1. Two EntitySets: Foo and FooView
      2. Two EntityTypes: Foo and FooView
    2. Your Conceptual Model should have:
      1. Two EntitySets: Foo and FooView – both with an EntityType set to ModelName.Foo
      2. One EntityType: Foo
    3. Your Mapping should have two EntitySetMappings:
      1. Foo with one EntityTypeMapping (“ModelName.Foo”) with one MappingFragment (“Foo”)
      2. FooView with one EntityTypeMapping (“ModelName.Foo“) with one MappingFragment (“FooView”)

    You should new be able to execute the following:

    Foo foo = new ModelEntities()
        .CreateObjectSet<Foo>("FooView")
        .First();
    

    You can give yourself a headstart by doing the following:

    1. Add Foo and FooView to your model
    2. In the Mapping Details of Foo click Add a Table or View and select FooView
    3. Delete FooView from your model
    4. Save the model and open it in the XML editor
    5. (pre-RTM) Find <EntityType Name="FooView"> in <StorageModels> and remove any incorrect entries from <Key> (it should match <EntityType Name="Foo">)
    6. Remove the <EntityTypeMapping Name="IsTypeOf(Foo)" /> and <EntityTypeMapping Name="IsTypeOf(FooView)" /> (they caused me errors)

    As of beta 2, implementing the above will break the designer

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.