Prism and Entity Structure

I saw in several examples, each module contains a folder called "Model", and they are all independent. I mean that module A does not have the same model classes than module B.

I implemented my database and used the Entity framework, but all of my modules should use several classes.

Is it possible to create a DLL named data (where it contains entities) and import into each module?

+4
source share
1 answer

I think that everything is in order. So you can have modules:

  • YourApplication (Shell bootstrapper only)
  • YourApplication.Infrastructue (all common interfaces, enumerations, etc.)
  • YourApplication.Data (or YourApplication.DAL ) - a project with Entity Framework objects
  • YourApplication.ModuleA (with links to *.Infrastructure and *.Data )
  • YourApplication.ModuleB (with links to *.Infrastructure and *.Data )

Prism recommends that ModuleA not be aware of ModuleB , and not that they should not use the same common projects (Prism manual contains YourApplication.Infrastructure , am I right? :))

But in general - it is very likely that you will need to add Models to your modules (even if you have an Entity Framework level), because very often business models and database models do not match. But if you can only use the database model, it will be great.

+6
source

Source: https://habr.com/ru/post/1388221/


All Articles