Greetings:
I have a use case that requires that an object be created using the ID of another object. On the surface it appears to be a child object, but a child collection is not required. For instance, I have an NVL object, CarrierNVL, for populating a combobox. Once a selection is made, including the defaults, general information is displayed from a RO object, CarrierRO. Based on the selection, the user wants to click "Add New Product..." to add a new product; however, the ID of the Carrier needs to be a field of the Product object. Does that make the Product object a child? Does the Carrier ID become the criteria passed to the NewProduct() factory method?
Not sure how the factory method and data portal method should look;
public static Product NewProduct(){
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a product"); return DataPortal.Create<Product>();
}
or
public static Product NewProduct(Guid carrierID){
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a product"); return DataPortal.Create<Product>(carrierID);
}
and
[
RunLocal()] private void DataPortal_Create(Criteria criteria){
_ProductID = Guid.NewGuid();
_CarrierID = criteria.ID
; //?????_EnteredBy = Csla.
ApplicationContext.User.Identity.Name;_EntryDate.Date =
DateTime.Today;ValidationRules.CheckRules();
}
or
[RunLocal()]
private void DataPortal_Create(Guid carrierID){
_ProductID = Guid.NewGuid();
_CarrierID = carrierID
; //?????_EnteredBy = Csla.
ApplicationContext.User.Identity.Name;_EntryDate.Date =
DateTime.Today;ValidationRules.CheckRules();
}
Any input is greatly appreciated.
Kelly.
jkellywilkerson:Does that make the Product object a child? Does the Carrier ID become the criteria passed to the NewProduct() factory method?
Thanks Rocky - I'll give that a try.
Kelly.
Copyright (c) Marimer LLC