Guid PrimeKey as Row Guid for Replication


Author
Message
Paul Chase
Paul Chase
Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
I am using Guid's a Primary Keys and also as Rowguid's for replication. The issue is on update's, If a field is specifed as rowguid it cannot be updated so the update fails.

I made the following changes to make this work can you please add to your code so I dont break at next update? or let me know how and what you want to change so I dont get a suprise next update Smile

Thanks

Paul

To Business layer I added this Property. (with a private as well)

''' <summary>

''' Gets or sets a value that determines whether the primary key for this business object is

''' a RowGuid

''' </summary>

''' <value></value>

''' <returns></returns>

''' <remarks></remarks>

<Category(EDITOR_CATEGORY_CRUD), _

DefaultValue(True), _

Description("Determines whether the primary key for this business object is a RowGuid.")> _

Public Property PrimaryKeyIsRowGuid() As Boolean

Get

Return Me._PrimaryKeyIsRowGuid

End Get

Set(ByVal value As Boolean)

Me._PrimaryKeyIsRowGuid = value

End Set

End Property

 

And in Data Layer

In method BuildUpdateInfo aroung line 573

'----------------------> Paul made a change the code here from

'--this

'-- Add the pk field to the fields to update if the primary key if not

' auto incremented

' If Not Me._BusinessObject.PrimaryKeyIsAutoIncremented Then

' loInfo.Fields.Add(lcFieldName)

' End If

'---> to

'-- Add the pk field to the fields to update if the primary key if not

' auto incremented or Row-Guid

If Not Me._BusinessObject.PrimaryKeyIsAutoIncremented AndAlso Not Me._BusinessObject.PrimaryKeyIsRowGuid Then

loInfo.Fields.Add(lcFieldName)

End If


Chan
Chan
Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I am thinking on this issue also. My initial plan to to auto add PK (if is row guid) to excluded update field list.



Any comment?
Paul Chase
Paul Chase
Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Chan,

Thats what I thought as well but excluding the PK from the fields to update causes another exception to be thrown as then the business object thinks there is no primary key

Richard Keller
Richard Keller
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 84, Visits: 324
Instead of putting in Strataframe code we built an extension layer for the BusinessLayer and Data Layer and simply use those objects when creating Business Objects so there is no compatability issues.   You could try that...

I for one think it may be a good idea for the SF team to have an empty extension layer for all SF objects and the New Items Wizard  use those objects and we could code against that layer if necessary and a migration tool later could verify that the New SF works with the current SF Extensions.   Just a thought and probbaly not thought all the way through.

There are cases in the User Control extensions that Strataframe had to be changed to accomodate an extension layer due to scope ( it's been awhile since I have been in that area so specifics escape me right now ).

Richard

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Paul, did you try adding the PK field name to the FieldsToExcludeFromUpdate?  That should do the same thing... if it doesn't then yeah we'll probably add a field called PrimaryKeyIsUpdatable (so it handles more than just RowGuids).
Paul Chase
Paul Chase
Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Ben,

Yeah I tried that first but it complains that there is no Primary Key Field. It makes sense once you step through that method why it doesn't work. PrimaryKeyNotUpdatable work's just let me know what ya end up doing.

Thanks

Paul

Richard Keller
Richard Keller
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 84, Visits: 324
Wouldn't setting Me._BusinessObject.PrimaryKeyIsAutoIncremented = TRUE work? I think you'd have to change the 

 loInfo.FieldDbTypes(loInfo.PrimaryKeyFields(0)) check to work with GUID's.  

Then maybe the PrimaryKey GUID of NewID() from the Database might work?

Richard

Paul Chase
Paul Chase
Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)Advanced StrataFrame User (598 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Hi Richard

I'm not using the newid() function to populate the Primary Key. I am handling the population of the Pk in my base business object by creating a sequential guid. 

The problem I am having here is that I am using replication and it requires one column to be a rowguid, because my primekeys are guids I also use them as rowguids, Rowguids cannot be updated and must be excluded from the update query.

Richard Keller
Richard Keller
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 84, Visits: 324
Understood,  I thought that by using replication that you wouldn't be using a Sequential GUID as different replication sources wouldn't be sequential.   Makes sense then.

Rich

Chan
Chan
Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)Advanced StrataFrame User (731 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Any other comments?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search