New To GUIDs

New To GUIDs

Old forum URL: forums.lhotka.net/forums/t/10416.aspx


ebick posted on Monday, June 06, 2011

I have used CSLA in a number of incarnations, but always avoided using the GUID (in favor of an int).

I am trying to do a new project now (using CSLA 3.8.3) using GUIDs and I am running into a strange issue.

Here is my ID Property:

    Private Shared IdProperty As PropertyInfo(Of Guid) = RegisterProperty(New PropertyInfo(Of Guid)("Id"))
    <System.ComponentModel.DataObjectField(True, True)> _
    Public ReadOnly Property Id() As Guid
        Get
            Return GetProperty(Of Guid)(IdProperty)
        End Get
    End Property

When I do a New, I call this.

LoadProperty(Of Guid)(IdProperty, Guid.NewGuid)

My IdProperty, after this call is all 0s (in a GUID format).

I played around with something like this:

Dim g as Guid = Guid.NewGuid.  The result of this is that g comes back with what looks like a valid Guid., but if I mouse over the +, it expands out and shows an "Empty" property with is all 0's.

The bottom line error I am getting is :

DataPortal.Update.failed (System.ArgumentException: No mapping exists from object type Csla.PropertyInfo 1

m2x replied on Monday, June 06, 2011

My best guess would be take the () off the ID property declaration. The Guid with all zeros can be checked for using Guid.Empty, which is a Guid's default value.

ebick replied on Monday, June 06, 2011

All the properties use the () after them.

ebick replied on Monday, June 06, 2011

The Guid wasn't my issue.  Please disregard, I am all set.

 

Thanks.

Copyright (c) Marimer LLC