sql server - Prism Modules and databases -


i'm busy learning prism 4 , in , outs of everything, i've yet see tutorial/walk through on want accomplish. hoping here has or has worked on similar project.

my application basic crud application i've broken down in separate areas of concern , hence modules. however, want modules share 1 common local sql express database. database start off limited number of tables start , each module check database tables needs , if not there, create them. how can go accomplishing this?

i've thought adding in tables seems break principal of modularity in mind. perhaps thinking wrong, point of loosely coupled modules if database aware , coupled given module db creation?

looking insight.

you seem asking 2 questions. first is: how can use prism ensure module specific schema exists in database, , if not, create it. second question is: how can best structure data layer such decoupled in modular application.

to answer first question how module schema check, this:

if you’ve been going through prism, you’ve no doubt thought couple of ways accomplish it. in programming, there many ways accomplish it. if needed prism, i’d following: create class (mypluginmodule.cs) in module assembly implements microsoft.practices.prism.modularity.imodule interface. put code in either constructor, or in initialize method, checks database see if module schema exists. if not, create it.

to answer second question how best structure data modularity, this:

like goblin says, depends on type of modularity trying accomplish. if selling application , want sell modules independent packages, not want create data model support package until end user has paid it.

you should able use entity framework ensure modules able share entities base application modules. additionally, depending on requirements are, or if architecture allow, may want abstract model/data layer assemblies not aligned modules. reduce code duplication , dependencies.

on application working on, we're using wpf mvvm, prism mef, , wcf data services. our client modules share data assembly communicates our main data service endpoint sits on top of base application model (authentication/role tables, application data, etc). when tables in our database created specific domain of module, new model , service endpoint created on server, , separate assembly created on client communicate data model.

if module specific model changes, affected components have changed, since module specific data encapsulated in own service , client assembly. better option isolation standpoint testing, security, etc. downside of course if base application model changes, of associated module specific implementations have updated.

but again, depends on requirements. if stick prism 4 mef, modular design patterns, , entity framework 4, should able come solution modular without being tightly coupled.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -