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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:07:00+00:00 2026-05-23T21:07:00+00:00

I am writing my first WPF application. I have also installed Entity Framework (EF)

  • 0

I am writing my first WPF application. I have also installed Entity Framework (EF) 4.1. I am a newbie in both. I am also learning to write MVVM classes by referring to a sample code.

I want to know whether I should first design classes for the Model, View and ViewModel or first design the database schema and use EF to auto-generate classes. Which is the recommended approach?

I have created three folders in my Visual Studio solution namely: Model, View and ViewModel. I will be adding respective classes to these folders. Any suggestions on this as well?

  • 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-23T21:07:01+00:00Added an answer on May 23, 2026 at 9:07 pm

    The main feature in Entity Framework 4.1 is Code-First development style and I would recommend to use this feature when you start with a new application and don’t have an existing database schema you have to start with.

    This means that you design your model classes first, specify perhaps some mapping details with either data annotations or in Fluent API and let EF generate database and database schema. In many cases you don’t need data annotations or Fluent API at all because EF 4.1 follows a set of mapping conventions, which means that EF can infer the necessary database schema from naming conventions of your classes and properties. This makes mapping of model to database very easy in many situations.

    In both approaches – database first or code first – you have to keep in mind that you want a working mapping between the two worlds. You can create model classes which can not or not easily mapped to a relational database schema and on the other side you can create a database schema which is difficult or impossible to map to model classes. So it makes sense to get familiar with examples how to create model classes which can be mapped to a database with EF 4.1.

    It’s somewhat a matter of taste if you want to start with the database schema or the model (and perhaps depends on if you have mighty database administrators behind your neck who possibly don’t like autogenerated database schemas). But in my opinion Code-First speeds up your development.

    Edit

    To your question about project organization: Having Views and ViewModels in one (“WPF-UI”) project is fine because they belong close together anyway. It’s also not wrong to put the model and all the EF stuff in this project. But there are good arguments to move Model and EF into a separate project (class library) in your solution. It allows you more easily to have other applications which access model and database (for instance simple tool programs (console app) to test something or do some work on the database).

    Many people would vote also to separate model and EF into separate projects (a “Domain or Business Logic project” and a “EF persistance layer project” or something). But since you say you are starting, this is perhaps too much of layered abstractions which can quickly get out of hand. You can always refactor at a later stage if you want a stronger separation of concerns.

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

Sidebar

Related Questions

I'm currently learning how to write a WPF application using the MVVM pattern. I'm
I'm writing my first WPF application and I'm trying to implement a fade animation
I'm writing my first real MVVM application, and the first step the user will
I am writing my first WPF and EF application. I am using SQL CE
I'm writing my first distributed erlang application, and I notice that I have to
Writing my first Linq application, and I'm trying to find the best way to
I'm writing my first Windows CE app using the .NET Compact Framework v3.5. I
I'm writing a WPF application which will monitor a feed. When there are new
I am currently writing my first Android application and I keep running into references
I am writing my first iPhone App, a test case before I write my

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.