Prism using Unity or MEF and EF Question

Prism using Unity or MEF and EF Question

Old forum URL: forums.lhotka.net/forums/t/10065.aspx


CyclingFoodmanPA posted on Saturday, February 12, 2011

First off, there are too many options!  I am in the process of re-architecting a large application and am torn between using Unity in Prism or MEF in Prism.  I know MEF comes with the .NET 4.0 Framework but I am trying to figure out which way to go.  I see lots of pros and cons for each and have worked through the Prism v4.0 Training kit a few months ago, but will be revisiting it again as I have been in Database land for a while, which leads me to the next question.

First, it is a Silverlight Enterprise application.

My database has over 240 tables and the tables are broken down by schema, for example, Pricing, Operations, Customer, Credit, Invoice, etc.  I am utilizing the EF 4.0 and the most recent Csla with the ObjectFactory (by the way, once I got my head around the ObjectFactory, I am liking it).  I am trying to decide if I want my Dal to be comprised of one WIndows Class library and have a number of .edmx files in there, for example BelAir.Dal will have Operations.edmx, Administrator.edmx, Security.edmx, etc.  Or, should I have a BelAir.Dal.Security, BelAir.Dal.Operations, etc which would break down a specific Dal for each major department.  Here is what I am thinking now:

1) By creating a separate Dal for each major department, I will be creating a more flexible application and more scalable, but a lot more projects.  As each department will have client and server business objects, example: BelAir.Business.Operations.Client, BelAir.Business.Operations.Server with a namespace of BelAir.Business.Operations.  This is what I am battling using Unity or MEF over.

So, if someone can recomend one way or the other for the Dal I would be most appreciative.  Also, if someone could recomend Unity or MEF I would appreciate it.  I really like Unity as it is easier to follow and debug where as MEF has attributes and may not be as easy to debug, but I would like another perspective on this.  I am the sole developer at my company and our parent company has an AS/400 system running RPG so no one has a clue what I am doing so I have no one to ask for guidance and to bounce ideas off of.  The good part is I choocse the architecture and "have it my way" the bad part is I bang my head against the wall a lot (that explains the dent in the left side of my head :).

Thanks for everyones help in the past in this forum.  Rocky has developed an awesome framework and this forum provides awesome support.

CyclingFoodmanPA

ajj3085 replied on Saturday, February 12, 2011

I can't help with Unity vs MEF, but as far as your Dal is concerned, I wouldn't break out tables into different edmx files.  We basically have this problem at my current employer; we have many 'repository" assemblies, many of which use the same database.  This disconnect leads to problems, such as different definitions for the same table.  You may have a clear separation now (I'd be suprised though), but at some point I bet you'll have two or more DALs which will share the same table.

In reality your database IS a shared resource; build your DAL to mirror that reality.  You'll have less maintence for your DAL if you accept that there is a database with 240 tables..

simon_may replied on Monday, February 14, 2011

Hi there. We are in a simillar position to yourself. Currently extablishing our developement framework and are keen on CSLA 4 in our business layer. Currently debating the DAL (though EF4 is attractive). And looking at PRISM to underpin our UI layer.

When looking at Unity vs MEF, My conclusion is that it is a close run thing. However, Unity appears to be more straightforward to code and as we are primarily targeting Silverlight cannot see how MEF's module discovery capabiliy (its only significant advantage over Unity) can be leveraged. So we have decided to use Unity.

Have other issues with PRISM but they are outside the scope of this forum and would love to discuss in another channel

Regards

Simon

JCardina replied on Monday, May 09, 2011

CyclingFoodmanPA
I am in the process of re-architecting a large application and am torn between using Unity in Prism or MEF in Prism.

I'm in the same position only a few months behind where you are, had a look and am leaning towards MEF primarily because it's included and nothing between the two was a showstopper. 

Which did you end up going with?

Also are you happy with Prism overall for your large CSLA project?

reagan123 replied on Thursday, June 16, 2011

Anyone make any progress here?  Sorry to bump a second Prism thread. :)

Copyright (c) Marimer LLC