views:

1144

answers:

5

I need to create several applications that all share a Microsoft SQL Server database. These include ASP.NET web applications, WPF desktop applications, and probably the odd console app every now and then.

I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic, and bind those objects to controls in my UI.

How can I do this in each of my applications without repeating myself too much? If the database schema or my business logic changes, then I want an easy (or automatic) way to update all my applications.

How should I architect this system?


Update: I've asked follow-up questions...

+9  A: 

Hi Zack, for that I would recommend creating a Visual Studio Solution that contains multiple Projects. Your DAL would be contained within its own project then for the other projects that need to make use of that functionality, create a Project Reference back to the DAL project.

Hope this helps!

Adam

Adam Alexander
+3  A: 

adamalex's idea is sound. depending on your setup, another favoured approach is to take the common projects separate, compile and then have your other projects reference this compiled dll. it is up to you if they reference the latest build of this dll or a specific version of it. perhaps you don't want some projects having to keep up all the time.

dove
Yes, agree that this approach is just as reasonable as the one I suggested. As always, it depends on your needs.
Adam Alexander
+2  A: 

Maybe you can use webservices to centralize the database access / logic...

As seen in the answers from link (SOA / WebServices / Remoting)

bob
If it's no overkill...
bob
+1  A: 

I'd recommend creating a new Visual Studio solution that contains multiple projects. For a DAL/BLL separation I would recommend using a class library. Making this abstraction allows you to wrap it by other projects like a WCF web service for example and expose it openly to not only .NET systems -- but potentially other systems.

Once you've created these class library project(s) you can add a reference to them in your other projects and use them. This will help keep a clear separation of concerns.

Chad Moran
+2  A: 

I would suggest you look at CSLA.Net. It allows you to build your business objects that easily support multiple interfaces (asp.net, wpf, silverlight, etc). I don't know what you are building but CSLA supports this very well.

I have a power point slide deck that may help get you going with CSLA.

CSLA Slide Deck

Keith Elder