StrataFrame Forum

Listview tag

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

By Chan - 2/5/2007

Hi,

I have a table which PK is a composite key, char(10), datetime.

How to set this to listview.tag?



Thank you
By Larry Caylor - 2/5/2007

You can add a custom property to your business object that returns the object’s primary key value. This will cause the primary key value to be displayed in the list of possible tag values when you configure the list view. The custom property would look something like

 

 ''' <summary>

''' Compound Primary Key

''' </summary>

''' <remarks></remarks>

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("CompoundPrimaryKey"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property [PrimaryKey]() As MicroFour.StrataFrame.Business.PrimaryKeyValue

   Get

      Return Me.GetPrimaryKeyValue()

    End Get

End Property

 

Make sure you add the custom property descriptor so the property is bindable. While this will get you the results you’re looking for, I try to stay away from compound keys since they are not really supported by the database deployment toolkit.

 

-Larry

 

 

By Trent L. Taylor - 2/6/2007

Great answer Larry, thanks!  Just FYI, the DDT does now support compound primary keys so you can go down this road as well if you choose.  When in the DDT, just select more than one field to be a PK.