Business Object Contents not Syncing with provided ID


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Peter,

Can you post a sample of what you are doing to reproduce this behavior?  It may be faster for if we can see first hand what you are doing so that we can provide you with a more clear response.  Thanks.

PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Ben Chase (09/14/2007)
I'm not sure on that. However, in your global.asax you can turn on the debugging on the data source to see what commands are being executed against the data source:



MicroFour.StrataFrame.Data.DataBasics.DataSources[""].SetDebugOn("C:\\Folder\\debug.html", true);



This will create a new file at c:\Folder\debug.html that will contain debug information on the commands that are executed against the data source.



You can also add an event handler to the CurrentDataTableRefilled event of your Supplier business object, put a break point in it, and check the call stack when the breakpoint is reached. That will tell you if anything else is automatically repopulating the business object.




I've tracked down the issue. I had to remove some references and ties in how it was populating the Supplier business object and more carefully looked at the attributes on the BLLM object. However, it would still be helpful to have some kind of documentation about the BLLM, it's default values, and how they affect the related entities.



This has all had a cascading effect and I've been fighting this new issue for the last three days and there's no reason why what I have shouldn't work. This is a simple, 1-M relationship between an entity and an address. First, I populated the parent entity. I have tried multiple methods to populate the child entity, but it's not pulling the correct ID from the parent entity to populate the child entity.





Contact.FillByParentPrimaryKey(intVendor);



BusinessParentRelationship ContactAddressRel = new BusinessParentRelationship();

ContactAddressRel.ParentBusinessObjectType = typeof(ContactBO).ToString();

ContactAddressRel.ParentPrimaryKeyField = new string[] { "ID_CON" };

ContactAddressRel.ForeignKeyField = new string[] { "ID_CON" };

ContactAddress.ParentRelationship = ContactAddressRel;



ContactAddress.FillByParentPrimaryKey(Contact.CurrentRow["id_con"]);





The problem I'm having, is that it pulls the contacts related to the vendor, in my case two different contacts with primary keys 3 and 4.



When I try to populate the ContactAddress object, it constantly tries to pull the incorrect PK for the contact. Contact 3 has no associated address (so it will be blank) and Contact 4 has an associated address record. The code continues to send 3 as the Primary Key, even when I've navigated to the next Contact (#4).



I've also tried specifying the parent-child relationship options with:





Contact.ChildBusinessObjects.Add(ContactAddress);

//Contact.ChildAutoFilterOption = AutoChildFilterOptions.MatchCurrentRow;

Contact.ChildAutoFilterOption = AutoChildFilterOptions.CascadeRowFilter;





This results in a NullReferenceException when I try to specify the ChildAutoFilterOption (doesn't matter which option I use, it throws an exception). I can't specify a parent relationship in the child object properties because ContactAddress is a generic "AddressBO" type that has a different parent relationship (I use the same business object to specify a SupplierAddress object -- and this one works fine and pulls the correct address record(s) for the supplier/vendor).



What is going on here? Why will it not pull the correct CurrentRow so I can get the right address object?



Thanks!
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I'm not sure on that.  However, in your global.asax you can turn on the debugging on the data source to see what commands are being executed against the data source:

MicroFour.StrataFrame.Data.DataBasics.DataSources[""].SetDebugOn("C:\\Folder\\debug.html", true);

This will create a new file at c:\Folder\debug.html that will contain debug information on the commands that are executed against the data source. 

You can also add an event handler to the CurrentDataTableRefilled event of your Supplier business object, put a break point in it, and check the call stack when the breakpoint is reached.  That will tell you if anything else is automatically repopulating the business object.

PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
One other thing I neglected to mention is that I've also tried navigating by primary key (i.e. Supplier.NavigateToPrimaryKey(new object[] { Int32.Parse(Page.Request.QueryString["SupplierID"]) })Wink and it goes nowhere.



Thanks!

PeterA
PeterA
StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)StrataFrame Novice (74 reputation)
Group: Forum Members
Posts: 72, Visits: 235
I know I must be missing something, but I'm completely lost as to what that something might be.



Previously today, I'd gotten business objects all working. I clicked on the link to the page (detail.aspx?SupplierID=3) and it pulled up the supplier information (the one identified with ID #3). It pulled up all the related data according to the relationships and addresses.



Then, I tried navigating to a different supplier detail from the listing page and it only brings up the original supplier.



For example, I have a listing page (listing.aspx) with a gridview list of two suppliers. The link generated for supplier 1 goes to "detail.aspx?SupplierID=1" and for supplier 2 goes to "detail.aspx?SupplierID=2". If I click either link, though, I bring up the same data.



I tried turning off HTTP caching with:





Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Cache.SetExpires(DateTime.Now);

Response.CacheControl = "Private";





When the IsPostBack property is false, I populate my business object:





Supplier.FillByPrimaryKey(Int32.Parse(Page.Request.QueryString["SupplierID"]));

SupplierAddress.FillByParentPrimaryKey(Int32.Parse(Page.Request.QueryString["SupplierID"]));





I did some checking and it turns out when I populate by Primary Key, it's putting information for 5 suppliers into the business object, even though the integer I pass it is unique.



I've defined the parent relationships (Supplier doesn't have one, but is part of several other M2M relationships). I've set the DataSourceKeys so it all pulls from the correct data source. I have the BusinessLayerLinkManager set and it has been properly handling the M2M relationships.



Why might it be pulling the same supplier information regardless of the ID I pass along?



Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search