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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:59:59+00:00 2026-06-09T17:59:59+00:00

I just started looking at Database Views with Code First… and try to decide

  • 0

I just started looking at Database Views with Code First… and try to decide if I should use them.

Here Ladislav recommends to use NotMapped inheritance parent for table and Db-View (my view only adds sums of child entities)… but how this work with CF Migrations? I really want to use them.

Also… navigation properties will work on Db-View Entity?

Is there any way to save data directly into Db-View entity (and it’s table)?

  • 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-06-09T18:00:00+00:00Added an answer on June 9, 2026 at 6:00 pm

    If you want to use code first and migrations you should not use views. Views are database “logic” constructs and code first is not an approach for creating database logic. With code first you should use the projection which is also mentioned in the linked answer.

    Migrations will not be able to detect changes related to your views. You will have to write all migration code for views manually.

    If you want to use views you should do database first (= no migrations) and either map them with EDMX or code mapping.

    Also… navigation properties will work on Db-View Entity?

    This is the only scenario where code mapping provides better support than EDMX. You can define relation in your model even if it doesn’t exist in the database (but your database must ensure data integrity). It is in theory possible with EDMX as well but it requires changing EDMX manually.

    Is there any way to save data directly into Db-View entity (and it’s table)?

    Yes but your view must be updatable. I don’t think that view with aggregation values is updatable.

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

Sidebar

Related Questions

Just started looking into Entity Framework and the new Code-First features. My question is
I just started looking at android app development. For my first test app i
i literally just started looking into php, connecting to a remote database and returning
I just started using Twitter Bootstrap http://twitter.github.com/bootstrap/scaffolding.html and I'm looking for the grey/blue navbar
I've just started at a new communications company, and we're looking at a workflow
I am just getting started couchdb and have been looking into writing couch apps.
HI all, I'm just getting started with developing for Android. I'm looking to port
Just started my first MVC 2.0 .net application. And I set up some default
I am looking to use a database project in visual studio 2010 so that
I just started developing with Ruby on Rails and I am looking for a

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.