Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing an object from within another business objec
Message
De
13/01/2009 14:52:41
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
13/01/2009 11:36:47
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01373249
Message ID:
01373338
Vues:
14
This message has been marked as the solution to the initial question of the thread.
Hi Rick,

>Good morning listers,
>Here's my question. I have a business object called warehouse which contains a property called resourcename. I also have created a business object called resource. What I want to do is to fill in the value of warehouse.resourcename from data from my resource business object.
>They aren't really a parent / child relationship. How can I instantiate a business object from inside another one?
>thanks
>rick

I am doing this in one of my business objects. My business object is just instantiating another business object and calling a method to retrieve data once so I have it available. In my case I have guids for all my PK's so I wanted to give the user a more friendly way to retrieve data. I use the property to obtain the actual PK from another biz obj. I am doing it in a property of the business object like this. There is a validation involved also, but you get the point.
public AccessValidation CompanyID
{
    get
    {
        if (_companyID == Guid.Empty)
       {
            this.oCompany = new CompanyAccess();
            this.oCompany.GetCompanyByCode(AppDesktop.AppSettings.MyCompanyCode.ToLower());
            if (oCompany.Entity.HasValues)
            {
                this._companyID = oCompany.Entity.CompanyID;
                if (oCompany.Entity.IsActive)
                    this._companyValid = AccessValidation.Valid;
                else
                    this._companyValid = AccessValidation.NotValid;
            }
        }
        return _companyValid;
    }
}
private AccessValidation _companyValid = AccessValidation.NotChecked;
private Guid _companyID = Guid.Empty;
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform