An implementation of LLBL that wraps the Entity classes rather than using inheritance

Posts   
 
    
Mountain
User
Posts: 21
Joined: 01-Apr-2005
# Posted on: 06-Apr-2005 16:44:32   

Has anyone succeeded (or tried and failed) in using a Wrapper design pattern to implement LLBL? In this approach, the proprietary business entities would wrap (contain) the LLBL entities rather than inherit from them.

Ideally, the proprietary business entities and the LLBL entities would reside in separate assemblies too.

It looks to me like this is not possible with the current architecture. For example, in SetRelatedEntityProperty, the generated code expects to be able to cast the IEntityCore entity to it's LLBL entity type. This is expected to be either the entity itself or a class derived from the entity. However, if it is a class containing the entity (wrapper), this cast fails.

        public override void SetRelatedEntityProperty(string propertyName, IEntityCore entity)
        {
            switch(propertyName)
            {

                case "Person":
                    this.Person = (PersonEntity)entity;
                    break;

One solution would be to use an explicit conversion operator in C#, but this doesn't seem possible if the 2 classes are in different assemblies with the LLBL assembly not knowing about the proprietary biz ent assembly (both referencing each other would create a circular ref).

Any comments or ideas are appreciated. Thanks!