Search code examples
reflectioninterfacedotnetnuke

What improvements can be done in Custom Business Object Class of dotnetnuke?


I worked on DotNetNuke in some projects and I find very much interesting Custom Business Object Class which is named as CBO.vb in the DotNetNuke project.

So I want to use this helper class in my other project also which is not in DotNetNuke but in core asp.net projects.

So I read about some important methods of this class which are majority used by me are:

  1. CBO.FillObject
  2. FillCollection

Now I am searching what are issues in this class that can be improved by me before I am going to use this class.

So I search this and found an interesting topic on code project which point out several issues like:

  1. business object and the fields in the database had to have the same name
  2. FillCollection method returned an ArrayList

So my question is there any other thing which can be solved before use like

use reflection to create objects which are slower for that they give idea how to implement this by using The IHydratable Interface

You can find class here


Solution

  • CBO is a useful class. However if I were looking for a similar solution today, I would look to one of the new "Micro-ORMs" such as:

    Massive

    PetaPoco

    Dapper

    When applying such a light wrapper around the database, I am not sure that supporting different names in the DB and business objects is really a good idea. It is a likely source of confusion.

    Also there are already generic overloads for the FillCollection method which return List<T>. The ArrayList versions are only there for backward compatibility, no one should write any new code with them.