﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Primekey = two fields</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Fri, 29 May 2026 13:16:33 GMT</lastBuildDate><ttl>20</ttl><item><title>Primekey = two fields</title><link>http://forum.strataframe.net/FindPost12955.aspx</link><description>I have an existing DB2 database I have to work with, they have many tables where the "key" is the combination of one or more fields. How can I accommodate this design using SF?&lt;br&gt;
&lt;br&gt;
The BO mapper lets me define multiple fields as primary keys via "Override Primary Key Specification", it then shows them as FIELD1,FIELD2. It is going to use the concatenation of these two fields as the primary key?&lt;br&gt;
&lt;br&gt;
If not I should just be able to control the assignment of the two key fields manually right? Its more work but I did it before as a work around before I got my auto incrementing key fields working.&lt;br&gt;
&lt;br&gt;
Thanks.</description><pubDate>Tue, 11 Dec 2007 14:39:46 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Primekey = two fields</title><link>http://forum.strataframe.net/FindPost12989.aspx</link><description>The updateable view using aliases for the "bad" field names worked, thank you.</description><pubDate>Tue, 11 Dec 2007 14:39:46 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Primekey = two fields</title><link>http://forum.strataframe.net/FindPost12984.aspx</link><description>On your first question, yes, the two fields are considered part of the PK.&amp;nbsp; Any time the record is uniquely referenced, both fields are included in the where clause, just like a compound primary key in SQL Server.&lt;/P&gt;&lt;P&gt;As for the second problem (the # signs)... I cannot think of a way to make it work off the top of my head.&amp;nbsp; If you manually remove the # signs, then you might have problems binding to those fields because the property descriptor is going to be looking for a different field name.&amp;nbsp; As far as I know, I cannot think of any compiled language that allows you to place # signs in the variable identifiers.&amp;nbsp; So, if you change the name completely within the business object, then it won't be able to reference the field correctly through INSERTs and UPDATEs, but if you leave it alone, then it won't be able to correctly compile in .NET.&lt;/P&gt;&lt;P&gt;I think the recommended workaround would probably be to create a view for the table and alias the names differently.&amp;nbsp; You could then build the business object from the view and the business object would no longer think there are # signs in the identifiers.&amp;nbsp; This option would require that the view be the DB2 equivalent of a SQL Server indexed view (to be updatable).&amp;nbsp; If the view cannot be indexed, then you would need to create sprocs for the INSERTs, UPDATEs and DELETEs.&amp;nbsp;</description><pubDate>Tue, 11 Dec 2007 09:57:18 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Primekey = two fields</title><link>http://forum.strataframe.net/FindPost12958.aspx</link><description>I got things to work by manually removing the # sign from the field names in the designer file of the BO for the properties, enums, and descriptor classes, the field names are enclosed in quotes when referencing the data tables so it seems OK so far, but my concerns are:&lt;br&gt;
&lt;br&gt;
1) anything I'm not seeing here that will break&lt;br&gt;
2) Every time I rebuild a partial for a BO with a field that has an "#" in the name i will have to manually change the designer code in each = yuck. Any way to alias the field names in the mapper or another technique to get me out of the soup?</description><pubDate>Mon, 10 Dec 2007 12:14:02 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item><item><title>RE: Primekey = two fields</title><link>http://forum.strataframe.net/FindPost12957.aspx</link><description>Also having problems with field names that have the # sign in them (FIELDNAME#), how might I fix that?&lt;br&gt;
&lt;br&gt;
Project wont compile after partials are rebuilt due to these errors (too many to list).&lt;br&gt;
&lt;br&gt;
Here is an example of one error:&lt;br&gt;
&lt;br&gt;
Bracket identifier is missing closing ']' for:&lt;br&gt;
&lt;br&gt;
[b]    ''' &lt;summary&gt;&lt;br&gt;
    ''' MNXSTYL#&lt;br&gt;
    ''' &lt;/summary&gt;&lt;br&gt;
    ''' &lt;remarks&gt;&lt;/remarks&gt;&lt;br&gt;
&lt;Browsable(False), _&lt;br&gt;
 BusinessFieldDisplayInEditor(), _&lt;br&gt;
 Description("MNXSTYL#"), _&lt;br&gt;
 DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)&gt; _&lt;br&gt;
Public Property [MNXSTYL#]() As System.Decimal&lt;br&gt;
        Get&lt;br&gt;
            Return CType(Me.CurrentRow.Item("MNXSTYL#"), System.Decimal)&lt;br&gt;
        End Get&lt;br&gt;
        Set(ByVal value As System.Decimal)&lt;br&gt;
            Me.CurrentRow.Item("MNXSTYL#") = value&lt;br&gt;
        End Set&lt;br&gt;
    End Property[/b]&lt;br&gt;
&lt;br&gt;</description><pubDate>Mon, 10 Dec 2007 11:58:46 GMT</pubDate><dc:creator>Keith Chisarik</dc:creator></item></channel></rss>