开发者

Dealing with data for a modular application

开发者 https://www.devze.com 2023-04-04 02:14 出处:网络
I created a modular application where each module only communicates through the other one with strong interfaces.Recently I found that we failed to separate the modules completely because there is a s

I created a modular application where each module only communicates through the other one with strong interfaces. Recently I found that we failed to separate the modules completely because there is a shared set of objects underneath that each of the modules access.

What is the best way to separate this layer out? The data objec开发者_如何转开发ts represents that that is displayed on the screen for a new record.


Looks like I'm in a same boat as you. If you have ORM(EF for example) and some kind of business object framework (RIA Services, DevForce) than you pretty much "locked" into having 1 assembly on each end (client/server)

If you want to go ahead and break this down I think it will cause more problems then it's worth. You will have issues joining entities from different modules, you will have repeating entities in different data modules, etc. If you already have ORM layer broken down - then by all means keep it same on client.

I would create just one data project (it's not even module in Prism) and reference it from all modules. In my case I reference it from main project and set "CopyLocal=true" just so MEF knows about those entities and I reference it from other modules and set "CopyLocal=false".


You typically create a domain assembly for your application (myproject. Infrastructure) that contains all shared classes. This assembly is referenced by all projects. With this approach your modules dont reference each other directly. (see also prism stocktrader reference implementation)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号