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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:11:15+00:00 2026-06-16T07:11:15+00:00

I am building an EF Code First driven application using an existing MSSQL database.

  • 0

I am building an EF Code First driven application using an existing MSSQL database. I really want to avoid having to use any power tools or wizard based auto-code generation utilities to build my model and dbcontext, as we will need total control over code gen.

My question is, when I build my models (which will end up as dbset() properties in my context), how should I approach the existing SQL columns in my models? Am I required to add a property to my model classes for every db column that is set to “Not Nullable” in the database? Will EF know what to do if I leave out some properties in my model, that corresponding to db columns? Just not sure how this should all work out and am having a bit of trouble finding resources with a direct answer to CF model to existing db field mappings. Does someone have information that would help clarify this process?

Any help would be greatly appreciated, and thank you!

  • 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-16T07:11:16+00:00Added an answer on June 16, 2026 at 7:11 am

    This is the only way I have worked with EF so far and have had no problems. EF will write null values to the DB if the property on your object is null. Also, all of your columns do not need to be represented in your Entity (although obviously all required columns need to be there, or have default values at the DB level if you want to do inserts). I think the reason it is hard to find some info on this these types of questions is this is the stuff ORMs just do, and do well. I would suggest just trying to create and use your first entities, and see what problems you encounter. It will likely be a lot easier than it seems from where you stand now.

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

Sidebar

Related Questions

When building an MVC application from scratch without a pre-existing database, is using the
I am building a web application using VS 2012 MVC4 code first. In order
I'm building a MVC 3 application and use Entity Framework 4.3 code-first. My context
I'm building a layered application using Entity Framework code first approach with an mvc4
I'm building a .NET 4 WPF application using Entity Framework code first and SQL
I am currently building my first MVC 3 application, using EF Code First, SQL
I’m building MVC3 code first application and to display data on my page I’m
I'm building a simple code-first MVC 3 blog like application. My model has three
We are using EF5, Code First approach to an MVC4 app that we're building.
I'm building an ASP.NET MVC 3 site using the code-first Entity Framework 4 approach.

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.