Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Basic Entity Framework Question

Basic Entity Framework Question

Scheduled Pinned Locked Moved Database
wpfquestioncsharpdatabasearchitecture
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    When you create an EF Data Context using DB first it creates data models for you. Those models are in the EDMX. I created the data in a project called DAL. Therefore the data context and the data models are all in that project. So then I add this project to a solution along side a WPF/MVVM project. To use the data models I then reference the DAL project, which gives me access to the data models. With EF is this the right way to do this? Directly reference the generated Data Models? Or do you somehow use your own data models? How do the generated Data Models handle INotifyPropertyChanged implementation in the WPF/MVVM project?

    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

    M 1 Reply Last reply
    0
    • K Kevin Marois

      When you create an EF Data Context using DB first it creates data models for you. Those models are in the EDMX. I created the data in a project called DAL. Therefore the data context and the data models are all in that project. So then I add this project to a solution along side a WPF/MVVM project. To use the data models I then reference the DAL project, which gives me access to the data models. With EF is this the right way to do this? Directly reference the generated Data Models? Or do you somehow use your own data models? How do the generated Data Models handle INotifyPropertyChanged implementation in the WPF/MVVM project?

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      M Offline
      M Offline
      mike14021
      wrote on last edited by
      #2

      I use Viewmodels for implementing INotifyPropertyChanged and a Converter which copies members of datalayer EF Model Classes to Viewmodel Classes. Example for viewmodel base class: https://stackoverflow.com/questions/36149863/how-to-write-viewmodelbase-in-mvvm-wpf

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups