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