How can I share DAL and BLL for multiple .NET applications?

I need to create several applications that all use a Microsoft SQL Server database. These include ASP.NET web applications, WPF desktop applications, and possibly a weird console application from time to time.

I would like to use the ADO.NET Entity Framework to access data, expand my objects for my business logic, and bind these objects to the controls in my interface.

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

How do I create this system?


Update: I asked the following questions ...

  • How to use LINQ for objects in Visual Basic?
  • How to extend Entity Framework ADO.NET objects with partial classes?
+6
architecture web-services entity-framework wcf
source share
5 answers

for this, I would recommend creating a Visual Studio solution containing several projects. Your DAL will be contained in your own project, and then for other projects that should use this functionality, create a link to the project back to the DAL project.

Hope this helps!

+9
source share

The idea of ​​adamalex sounds. depending on your installation, another preferred approach is to share common projects, compile, and then use your other projects in this compiled dll. it is up to you if they reference the latest build of this DLL or its specific version. perhaps you do not want some projects to be constantly monitored.

+3
source share

Perhaps you can use web services to centralize access to the database / logic ...

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

+2
source share

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

I have a Power Point slide panel that can help you transition with CSLA.

CSLA Slide Deck

+2
source share

I would recommend creating a new Visual Studio solution containing several projects. To separate the DAL / BLL, I would recommend using a class library. Creating this abstraction allows you to wrap it in other projects, such as the WCF web service, and open it open not only for .NET systems, but also for other systems.

After creating these class library projects, you can add a link to them in your other projects and use them. This will help maintain a clear separation of concerns.

+1
source share

All Articles