Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prism and Entity Framework

I've seen in several examples, each module contains a folder called Model, and all of them are independent. I mean the module A has no the same model classes than Module B.

I've implemented my database, and using Entity framework, but all my modules need to use several classes.

Is it OK to create a dll called data (where contains the entities) and import to each module?

like image 664
Darf Zon Avatar asked Dec 28 '11 00:12

Darf Zon


1 Answers

I think absolutely OK. So, you can have modules:

  • YourApplication (just Shell bootstrapper)
  • YourApplication.Infrastructue (all shared interfaces, enums etc.)
  • YourApplication.Data (or YourApplication.DAL) - project with Entity Framework's entities
  • YourApplication.ModuleA (with references to *.Infrastructure and *.Data)
  • YourApplication.ModuleB (with references to *.Infrastructure and *.Data)

Prism recommends that ModuleA should not know about ModuleB, not that they should not use the same shared projects (Prism guide contains YourApplication.Infrastructure itself, am I right? :) )

But in general - it's very probably, that you will need add Models to your modules (even if you have Entity Framework layer), because very often business models and database models aren't the same. But if you can use just database model - it will be great.

like image 165
chopikadze Avatar answered Sep 18 '22 12:09

chopikadze