views:

228

answers:

2

Is it fine to have the DAL return a DTO type from the Domain model vs just returning a DataTable? Isn't is looser to have your DAL functions return DataTables/DataSets and have your BLL map the data to business objects?

+1  A: 

I think it really comes down to personal preference, but I like to avoid DataTables whenever possible.

They can be convenient at times, but the fact that they aren't strongly typed tends to make debugging, testing, and just understanding the code much more difficult.

Eric Petroelje
+1  A: 

For small-sized apps, in .NET, it would be best to base your architecture on DataSets and DataTables. You have direct binding support for UI, for reporting, and it scales nicely until you get to some bigger domain problems. Check Fowler's Patterns of Enterprise Application Architecture book, particularly Table Module and Table Data Gateway patterns.

For anything more complex, it always pays off to have good domain model, and appropriate layers around it (ORM mapper, Remoting and Service layers, etc...). For these patterns, check the previously mentioned book, preferably with Domain Driven Design by Eric Evans

Sapphire