passing an entity as an interface

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 25-Jun-2007 18:56:05   

version 1.0.2005.1 final (self-servicing) VS2005 asp.net 2.0


hiya,

I have 2 entities in my app which (though they come from different tables) contain exactly the same fields.

BusinessChangesEntity bizEntity = new BusinessChangesEntity();
BusinessEntity bizEntity = new BusinessEntity();
        

Is there any way that I can pass these entities as interfaces, instead of their concerete classes?

many thanks,

yogi

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 25-Jun-2007 20:04:41   

yogiberr wrote:


version 1.0.2005.1 final (self-servicing) VS2005 asp.net 2.0


I have 2 entities in my app which (though they come from different tables) contain exactly the same fields.

BusinessChangesEntity bizEntity = new BusinessChangesEntity();
BusinessEntity bizEntity = new BusinessEntity();

Is there any way that I can pass these entities as interfaces, instead of their concerete classes?

If I'm not mistaken, LLBL 1.0.2005 generates partial classes when you target .Net 2.0, so all you would have to do is:

  1. create your interface in the DBGeneric Project
  2. Create additional partial classes for those two entities
  3. In the (additional) partial classes, have the entities implement the interface.

HTH,

Phil