There are a number of ways to handle this. One option is to create a Scalar method or call a sproc that returns you the value from the server in the SetDefaultValues of the BO. As you probably already know, StrataFrame will automatically manage primary key values and then update the child with the parents PK once it has been committed. But as far as unique values on non-pk fields, you could go down a lot of roads. We have one instance in our medical software where we have a table that has several fields:
RecordType - Identifier for the table requesting a unique value (you can use an enum on the BO)
FieldName - The name of the field
LastValue - The last value that was handed out. We update this field each time a new value is retrieved
You can then have a single BO that hands out unique values. You can also create a shared method on teh BO so you do not have to create an instance:
Public Shared Function GetNextValue(Byval type as MyRecordTypes, Byval fieldName As String) As Integer
'-- Create a temp instance of the BO
Using temp As New MyUniqueValueBO()
'-- Perform your query (usually a scalar method)
'-- Update the BO with the most recent value retrieve
End Using
End Function
Then in any BO which needs a unique value you would just call the GetNextValue method:
me.MyUniqueField = MyUniqueValueBO.GetNextValue(myType,"MyField")