C# – DAL and BLL in .NET

asp.netbllcdata-access-layerdatatable

There is this DAL/BLL design suggestion by Microsoft for ASP.NET (2.0) apps. I know some of the alternatives and I've read related questions here on SO. However I wonder if this proposed solution is worth implementing nowadays, is there a specific downside you know of?

I want to develop DAL/BLL components for company-internal use, to access customer and employee data, etc from various applications and scripts. However before I start building that stuff, I want to be sure that this solution is 'good'. As example, the BLL passes datatables instead of encapsulating anything, you don't have isolated business objects that contain logic. It's basically only a dumb layer that eases the CRUD operations a bit and allows databinding for controls.

Could someone, who has experience in this field, point me out the pro's and con's of this approach?

Best Answer

I fully recommend NOT USING DATATABLES. Look into a domain driven design implementation that your entire framework will work with regular objects that you can pass into List<> or Queryable<>. DataTables are garbage that shouldn't even be included in .NET anymore.

I would also recommend looking into using a Dependency Injection / Inversion of Control framework such Microsoft Unity or StructureMap to create loosely coupled code.