It's about interfaces again

Posts   
 
    
knez
User
Posts: 37
Joined: 01-Nov-2004
# Posted on: 28-Mar-2005 15:20:15   

Hi!

Few months ago I tried to change the way Presentation Layer deals with entity objects and entity collections by exposing them as interfaces (http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1664). By doing that I got for example (speaking in Northwind terms):

public class OrderEntity : EntityBase2, IOrderEntity, ... 
{
  ...
  // Properties
  public IList Orders // (IList instead of EntityCollection)
  {
    ... // Exactly same implementation as in original template.
  }

  public ICustomerEntity Customer // (ICustomerEntity instead of CustomerEntity)
 {
   ... // Exactly same implementation as in original template.
  }
...
}

public interface IOrderEntity
{
IList Orders
{
get;
set;
}

ICustomerEntity Customer
{
get;
set;
}
...
}

But I ran into some problems while doing recursive save which failed on one to many relations. I tried to figure out what was going on, but eventually I gave up on it (well, it seemed until now wink ).

I wonder if anyone has tried anything like that? Will it be possible in new version of LLBLGen Pro?

Vladimir
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39750
Joined: 17-Aug-2003
# Posted on: 30-Mar-2005 11:32:21   

public interface IOrderEntity
{
IList Orders
{
get;
set;
}

That's wrong, never expose the lists as IList. That will call another 'Add()' method than the one in the entitycollection classes.

Frans Bouma | Lead developer LLBLGen Pro