StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



.ParentRelationship property (changing...Expand / Collapse
Author
Message
Posted 07/07/2006 11:05:41 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 06/19/2008 11:16:33 AM
Posts: 73, Visits: 12,471

Executive Summary:

 

How do I dynamically/programmatically change the .ParentRelationship property on an ASPX codebehind page as it loads?

 

Details:

 

I thought I would be able to populate the ParentRelationship property dynamically using the string that appears after using the builder … unfortunately though, as my accounting teacher stated, “Ignorance is bliss … but only for a time”.

 

 

MailAddr.ParentRelationship = "Person, (iID) <--> (iPersonFK)"

 

MailAddr = "Company Location, (iID) <--> (iCompanyLocationFK)"

 

MailAddr.ParentRelationship = "Courthouse, (iID) <--> (iCourthouseFK)"

 

MailAddr.ParentRelationship = "Employee, (iID) <--> (iEmployeeFK)"

 

MailAddr.ParentRelationship = "Investigator, (iID) <--> (iInvestigatorFK)"

 

Further testing simply served to illustrate the level of my ignorance … not to mention short lived blissfulness.  I soon

discovered that this property is really a reference to an object of the following nature:

 

MicroFour.StrataFrame.Business.BusinessParentRelationship

 

A short hunt through the code brought me to this Public Interface:

 

Namespace Business

 

Public Interface IBusinessParentRelationship

 

#Region " Properties "

        Property ParentBusinessObjectType() As String

        Property ParentPrimaryKeyField() As String()

        Property ForeignKeyField() As String()

#End Region

 

#Region " Methods "

        Function Clone() As IBusinessParentRelationship

#End Region

 

End Interface

 

End Namespace

 


At this point, my ignorance kicked in again and I was hopeful that I could simply assign a string to these properties and

then assign that object to the .ParentRelationship property of the MailingAddress business object.  Silly boy … as

“value of type string cannot be converted to a one dimensional array of string”.  Sigh

 

 

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField = "iPersonFK"

oPersonMARel.ParentPrimaryKeyField = "iID"

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel

 

Ok, I says to myself … much less confident in my ability to do anything at this point other than poo in my shorts … let’s try this:

 

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField(0) = "iPersonFK"

oPersonMARel.ParentPrimaryKeyField(0) = "iID"

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel

 

But, alas, no, as it is obvious I don’t know how to deal with one dimensional arrays of type string.

 

So, I fall back to your expertise.  How do I dynamically change the .ParentRelationship property on an ASPX page?

 

 

CT

Post #1767
Posted 07/07/2006 11:34:20 PM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 06/19/2008 11:16:33 AM
Posts: 73, Visits: 12,471

How do I dynamically/programmatically change the .ParentRelationship property on an ASPX codebehind page as it loads?

 

Should read:

 

How do I dynamically/programmatically change the .ParentRelationship property of a child business object on an ASPX codebehind page as it loads?

 

Thanks,

 

CT

Post #1768
Posted 07/08/2006 11:01:21 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 09/26/2008 8:30:36 AM
Posts: 2,685, Visits: 1,886
Oh, CT, you are so close

You only need to change the strings to read like this:

New String() {"Value"}  '-- Creates a new string array with only one element

So, this:

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField(0) = "iPersonFK"

oPersonMARel.ParentPrimaryKeyField(0) = "iID"

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel

 

Should be this:

 

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField(0) = New String() {"iPersonFK"}

oPersonMARel.ParentPrimaryKeyField(0) = New String() {"iID"}

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel




www.bungie.net
Post #1774
Posted 09/20/2006 10:53:10 AM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 08/30/2007 12:23:01 PM
Posts: 25, Visits: 64
Here is a C# example, including use of 2 keys in the relationship:


MicroFour.StrataFrame.Business.BusinessParentRelationship oPersonMARel = new MicroFour.StrataFrame.Business.BusinessParentRelationship();
oPersonMARel .ForeignKeyField = new string[] {"Field1ofKey", "Field2ofKey"};
oPersonMARel .ParentPrimaryKeyField = new string[] { "Field1ofKey", "Field2ofKey" };

oPersonMARel .ParentBusinessObjectType = "IMA.BOLibrary.Person";
oMailingAddress.ParentRelationship = oPersonMARel

oMailingAddress.ParentBusinessObject = oPersonMA


Just may make life a bit easier for next person to do this
Post #2929
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 4:16pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.094. 12 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.