StrataFrame Forum

Issues to Override the Property "PrimaryKeyField"

http://forum.strataframe.net/Topic798.aspx

By Sven Heitmann - 4/13/2006

Hi



I'm using the Pre-Release of your Application Framework (1.4.0) and I get an error when I want to start the Visual Basic WinForms-Example or Tutorials:

"Public ReadOnly Property PrimaryKeyField() As String" wurde nicht als "Overridable" deklariert und kann daher nicht von "Public Overrides ReadOnly Property PrimaryKeyField() As String" überschrieben werden.   C:\Programme\MicroFour\StrataFrame\VB.NET Tutorial\Tutorial_WinVB_14\OrdersBO.Designer.vb





I have the german version of Visual Studio... so I am sorry for non-english errormessages...



The problem is that the Property PrimaryKeyField was not declared as Overridable, so I can not override it in the subclass...



Shall I download version 1.3.0 instead or is there some quick solution?



Best regards

Sven
By Trent L. Taylor - 4/13/2006

Sven,

Yes, sorry about this.  The tutorials on the pre-release have not bee updated so you are getting the error because the PrimaryKeyField is now an array instead of a String.  THis was added to support compound primary keys.  You can resolve this error yourself if you would like by changing the line in error to something like this:

Me.PrimaryKeyField = New String() {"TheFieldname"}

ALso, we will have the official 1.4 release available next week and the tutorials will be updated as well Wink  Let me know if this doesn't answer your question.

By Jerry Carter - 4/17/2006

I'm having the same problem and your suggested solution gets rid of one of the errors but I am unable to run the sample. I have two different errors. I suppose I can wait until 1.4 is official but after seeing a demo over the weekend, I'm anxious to start using it. My first error repeats itself in all four business objects.

Public Overrides ReadOnly Property PrimaryKeyField() As String
    Get
       
Return "cust_pk"
    End Get
End Property

The error is on "PrimaryKeyField". VS help suggests that I use Overload or Shadow instead of Overrides.

The other error I get I believe you address in your post but I just wanted to make sure.

BusinessParentRelationship1.ForeignKeyField = "orit_or_pk"
BusinessParentRelationship1.ParentBusinessObjectType = "StrataFrameSample.OrdersBO"
BusinessParentRelationship1.ParentPrimaryKeyField = "or_pk"

The error is on "orit_or_pk" in the first line and "or_pk" in the third line. These errors occur in the Order Items business object. I have similar errors in the Orders business object.

I'm pretty new to VS so this may be an obvious fix for a veteran. I hope you dont mind helping out a "newbie" 

By Trent L. Taylor - 4/17/2006

Jerry,

Never feel bad for asking a question!  That's what a forum is about.  Besides, this is a very valid question.  The problem is that we have added some functionality in version 1.4 to support compound primary keys which in turn supports compound foreign keys.  This means that each of the errors requires that the definition is an array instead of a string.  To do this, the definition would be like this:

BusinessParentRelationship1.ForeignKeyField = New String() {"orit_or_pk"}
BusinessParentRelationship1.ParentBusinessObjectType = "StrataFrameSample.OrdersBO"
BusinessParentRelationship1.ParentPrimaryKeyField = New String() {"or_pk"}

Let me know if this doesn't clear things up.  Also, the official 1.4 release will be released this week and the tutorials will be fixed as well.  Sorry for any trouble this may have caused.

By Jerry Carter - 4/18/2006

Hi Trent

That cleared up 4 of the 8 errors that I am getting. How do I apply what you told me to the first set of errors?

Public Overrides ReadOnly Property PrimaryKeyField() As String
    Get
       
Return "cust_pk"
    End Get
End Property

By Jerry Carter - 4/18/2006

Hey Trent--

No need to reply here. I went and rebuilt the business objects in the BO Mapper and these errors corrected themselves. Thanks for your help.

Jerry

By Sven Heitmann - 4/19/2006

Thank you for your help. Smile
By Trent L. Taylor - 4/20/2006

Glad you got it going.  Smile  Let me know if you have another other issues.