BusinessListbase

BusinessListbase

Old forum URL: forums.lhotka.net/forums/t/5479.aspx


KJosh posted on Friday, September 26, 2008

Hi,

   I am developing the busienss objects using CSLA framework. I have the customer object(with fields id, name) inheriting from BusienssBase base class. Now I want to create the Collection of customers like Collection<Customer>. In CSLA I am creating the collection of customers like the below:

class Customers : BusinessListBase<Customers, Customer>. Am I creating the Customers business class in the correct way?

Thanks in advance

sergeyb replied on Friday, September 26, 2008

Looks good to me.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: KJosh [mailto:cslanet@lhotka.net]
Sent: Friday, September 26, 2008 11:16 PM
To: Sergey Barskiy
Subject: [CSLA .NET] BusinessListbase

 

Hi,

   I am developing the busienss objects using CSLA framework. I have the customer object(with fields id, name) inheriting from BusienssBase base class. Now I want to create the Collection of customers like Collection<Customer>. In CSLA I am creating the collection of customers like the below:

class Customers : BusinessListBase<Customers, Customer>. Am I creating the Customers business class in the correct way?

Thanks in advance



JoeFallon1 replied on Saturday, September 27, 2008

"class Customers : BusinessListBase<Customers, Customer>.

Am I creating the Customers business class in the correct way?"

============================================

Technically, the answer is Yes.

Practically speaking it is No.

You are inheriting directly from Csla itself. What you are "missing" is a set of intermediate Base classes which you create for each type of Csla class. (Like MyBusinessBase.) 

These Base classes are the ones that inherit directly from Csla. Then all of your business objects inherit from your own base classes. You should do this even if you do not have anything to add to your own Base classes. Because later on - you will find something unique to your systems and develpment style that will cause you to want to add something to enhance your business objects and sticking that code in your own Base classes means all your existing BOs pick up the new functionality right away - without having to go back and edit them all.

There have been many posts on this topic - do a search and you should find a thread with example empty Base classes. They can be a bit tricky to create if you are not experienced in Generics. It is easier to just copy a "correct one" and give it your own name.

HTH

Joe

 

KJosh replied on Sunday, September 28, 2008

JoeFallon1:

There have been many posts on this topic - do a search and you should find a thread with example empty Base classes. They can be a bit tricky to create if you are not experienced in Generics. It is easier to just copy a "correct one" and give it your own name.

Hi Joe,

 Could you give me the links which explaing the creation of my own business classes inheriting from CSLA. I am not able to find them.

Thanks in advance

Copyright (c) Marimer LLC