Designing a Web Platform with Modules using EF 4.3

I am trying to build a web platform (king of CMS) using EF 4.3 with migrations. So I want to factor all my work from other projects like e-commerce, newsletter, blog, etc .; into separate ClassLibrary projects containing the models (maybe we'll create some NuGet packages later). And I was hoping I could integrate them into my own mvc3 template and then use some extended forests for my controllers and views.

So first I have my own MVC3 template which has a ClassLibrary project containing my authentication model (some repos and some custom providers with two Entity Framework: User and Role using "BaseDataContext"). And second, I have another ClassLibrary project named Blog that contains a model for my blog (all EF POCOs, some repositories and "BlogDataContext") I am also using IoC.

The first problem I ran into was CircularDependecy, I need a link from my blog to my template and one from my template back to my blog if I want my Blog.Author to inherit from my Template.User and my POCO user. to contain a link to my author. I know the auth and blog model is on the same level and should be in the same class library, but given the fact that many more libraries will be added later (like the bulletin library), I cannot decompose entities into one single library. The second problem I am thinking about is using multiple DataContexts, but that is a different question.

So, in conclusion, my question is not very specific. This is an architectural design issue. I am trying to achieve what I am trying to achieve? Or is it possible to try to find a way to the CircularDependency problem? If not, how should I create a "CMS" or how should I make it easier to reuse my work. (I found the migration function interesting if, for example, you have a working e-store and a customer asks to add a blog)

Thanks in advance.


source to share

1 answer

I would look at the decoupling of your entire design, make all logical units (single sign-on, cms, e-comm, report, etc.) independently of each other and figure out how to communicate between them with the least amount of data possible. For example, you can pass the GUID of the authenticated user to the CMS instead of the entire User object. Once you figure this out, using WCF and WF , you can organize messages, create workflows, etc. The biggest benefit you'll get is your platform is pluggable and scalable, and you can add or remove components based on your needs, or add and remove resources based on your download.



All Articles