views:

11

answers:

1

I have an entity class that has a property that contains a business code. I would like to add a property that will contain the description of that business code. To do this it will require that I query another entity collection, but the entity collection doesn't seem to be accessible in the partial class of the entity. I can't solve this with an association because the codes will not alway exist in the desciprion table.

Any ideas?

A: 

The collections and referenced entities are not available on the entity construction, so no partial methods or overrides are available for collections or referenced objects.

But...

You can simply add your partial class a Getter that will return or initiate your business logic when called as the entity is fully loaded then, and everything could be referneced as usual :

public partial class Organization
{
..
..
   public bool IsIsoCertified
    {
        get
        {
            return CheckIsoCert();
        }
    }


    private bool CheckIsoCert()
    {
        return this.CertCollection.Contains(Certifications.IsoCertification);
    }

..
..
OrPaz