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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:13:21+00:00 2026-05-25T01:13:21+00:00

I have three views that I’ve manually created in the DB. First view is

  • 0

I have three views that I’ve manually created in the DB.

First view is “Region”, the second is “FIPS” and the last is a many-to-many between them called “Region2FIPS”. These are all views, and I only need read access the data, so I’m not worried about having updateable views.

I have added each of these views to Entity Framework, and created the appropriate associations between them.

Region to Region2FIPS is a 1 to many.
FIPS to Region2FIPS is a 1 to many.

The “Region2FIPS” view contains only two columns, one called “FIPSID” the other “RegionID”. These column are associated with their respective views in the relationships I defined above.

When this type of association is made on tables in the DB, Entity Framework knows that it is a many-to-many relationship and it creates a navigation property on “Region” called “FIPS” that I can use to navigate through the child collection of FIPS. It does likewise for “FIPS” to “Region”.

However, when done manually, with views, it does not exhibit that behavior. Instead, my “Region” object has a collection of “Region2FIPS” objects, which each have a navigation property called “FIPS” which is of type “FIPS”. And my “FIPS” object has a collection of “Region2FIPS” objects, which each have a navigation property called “Regions” of type “Region”.

I assume this has something to do with the fact that I can’t create foreign key references on the views, so entity framework doesn’t realize the many-to-many relationship. But I thought that if I manually created the many-to-many relationship between the views it would recognize it and properly handle the navigation between the types. Is there a way for me to force it to do this?

  • 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-25T01:13:22+00:00Added an answer on May 25, 2026 at 1:13 am

    It’s possible, but the designer doesn’t really help you here. You have to do the mapping manually.

    One fairly easy way is to use Code First mapping. But this means your model has to be Code First to begin with. If you’re writing a new model, just do that.

    If you’re using DB First mapping, however, you will have to do the mapping manually. Your SSDL will probably already be correct, once you define the “primary keys” of the views. You would then have to remove the “Region2FIPS” objects from the CSDL (not just from the designer!) and manually patch up the MSL.

    Perhaps the easiest way to do this would be to use the designer to automatically map real DB tables (not views) with a similar schema and then replace the table names with view names in the EDMX, using the XML editor.

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

Sidebar

Related Questions

I have seen posts that show three ways to reset the DMV views: Reset
I have three unordered lists that have been created as Scriptaculous Sortables so that
In one of my iPhone projects, I have three views that you can move
IN my apllication i have three Views One,Two,Three. In all view I made one
This may be more of a best practice question. I have three views (create/details/edit)
I have a ViewFlipper implementation that needs to be improved. This ViewFlipper has three
I have a Silverlight application that has three regions that will host the same
I have currently created a facebook like page that pulls notifications from different tables,
Like many other developers out there, I've created iPhone projects that use a UITabBarController
There's no strongly typed View() method to return an ActionResult. So, suppose 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.