Dataset, Typed Dataset or NHibernate?

Not again.... I know some of the experts here will say. But I have read tons of articles, blogs, forums, and still can't decide on which to use to pass the data among the layers.

Here is what my design need to take care of:

1. 3 layers architecture, where UI, BLL and DAL should be seperated.
2. The BLL/DAL should be somesort like "portable", can be reused in Windows Application and Web Application. So no repeated code needed.
3. The BLL/DAL can be called from within an application or through remoting/web service.
4. The BLL/DAL can act like APIs which can intergrate with other non-.Net system (VB6, VFP, C++, Java, etc.)

I have to mention I have no experience in remoting, web service and COMIneterop (yet), but these will be the things required in the future.
As I am given the time to evaluate the architure for our next project developed from scratch (which could evolved into an ERP system), I wish to find out which is the right direction to go.

Any, any, advice would be much appreciated. Thanks.

Regards,
Chang



Answer this question

Dataset, Typed Dataset or NHibernate?

  • Dr.Virusi

    If you are going to use web services don't use datasets for passing data between tiers; the performance hit is huge.

    Use custom collections instead. They are faster and more flexible.

    If you are interest, I can guide you through on how to generate custom business entities automatically, using generation tools (MyGeneration) from your database tables and views.

    Ubercoder.


  • vijil

    Hi,

    you should really take a look at Microsoft Pattern & Practices "Web Service Software Factory" and "Smart Client Software Factory". These two factories will produce the bulk of all the piping needed for a three layer solution and client. The way to the future...

    Regards BjornS


  • Jiajia

    Thanks for the advice.

    As web service and interopatibility are the issues, is custom objects the only choice I have That's why I stumble upon NHibernate (also ActiveRecord from CastleProject) as I thought this could help me in my development (if I use custom objects).

    However, from the "Application Interoperability" book metioned by Clemens, there is an informative link http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnbda/html/distapp.asp, which stated somewhere:

    ..."The data format you choose to use depends on how you want to work with the data. It is recommended that you avoid designs requiring you to transfer data in a custom object-oriented format, because doing so requires custom serialization implementation and can create a performance overhead. Generally, you should use a more data-centric format, such as a DataSet, to pass the data from the data access logic components to the business layers, and then use it to hydrate a custom business entity if you want to work with the data in an object-oriented fashion. In many cases, though, it will be simpler just to work with the business data in a DataSet."...

    Ok, more confusion here (for me):
    1. As I am using .Net 2.0, is Typed Dataset performance will not become an issue
    1. Can typed dataset be used when interop with non-.Net system
    2. Can typed dataset be used in web service
    3. Is there any sample on writing Service Interface
    4. Is there any Sample Application which can demonstrate the features that I need (datasets or custom objects)

    Thanks again.


  • Swal

    to make you UI "portable" look at the MVC Pattern.

    Use the BLL/DAL for non .NET systems or remoting / web services: Define service interfaces that expose your business components, they are a entry point to your business components for services and other systems that must interop with your components and of course the Facade pattern. Don't expose datasets or Typed datasets in your business layer when other systems then .NET must communicate with them. NHibernate is for BLL - DAL communication == off topic

    Take a look at WCF and Application Interoperability



  • G20

    Look here: http://pluralsight.com/drjoe/webcasts/webcasts.aspx there is a webcast about "Designing Distributed Apps around Web Services" and "Designing Distributed Apps around Remoting" including sample code.

  • faraaz_malak_c92eb4

    chawacho wrote:


    0. As I am using .Net 2.0, is Typed Dataset performance will not become an issue
    1. Can typed dataset be used when interop with non-.Net system
    2. Can typed dataset be used in web service

    regarding performance of typed data sets - you can get it to perform well - what kind of scenarios are you looking forward to handle

    regarding using typed-datasets with webservices - it goes against the whole idea of interoperability (it also goes against the whole notion of services if you would go with SOA). It can be done though (but as I said not very recomended)

    By the way you may find my paper on O/R mapping relevant to your original questions http://www.rgoarchitects.com/blog/content/binary/ORMappin.pdf

    Arnon



  • Dataset, Typed Dataset or NHibernate?