RegistarProperty Nullable Types

RegistarProperty Nullable Types

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


ward0093 posted on Tuesday, October 14, 2008

I am getting an issue with "LoadProperty" call when inserting a new record.  I looked at some previous posts but i think this is an issue with "Nullable Types"

I get an "Index was outside the bounds of the Array." with an outer error "One or more properties are not registered for this type"

Here is my code (that is blowing up)

LoadProperty(Of Guid?)(UserCreatedIDProperty, sxr.GetValue(Of Guid?)("UserCreatedID"))

Here is my property statement

Protected Shared UserCreatedIDProperty As PropertyInfo(Of Guid?) = RegisterProperty(New PropertyInfo(Of Guid?)("UserCreatedID", "ID of User Who Created Item", Nothing))

Public Overridable ReadOnly Property UserCreatedID() As Guid?

Get

Return GetProperty(Of Guid?)(UserCreatedIDProperty)

End Get

End Property

 

THE ERROR:

?ex

{"One or more properties are not registered for this type"}

System.InvalidOperationException: {"One or more properties are not registered for this type"}

Data: {System.Collections.ListDictionaryInternal}

HelpLink: Nothing

InnerException: {"Index was outside the bounds of the array."}

Message: "One or more properties are not registered for this type"

Source: "Csla"

StackTrace: " at Csla.Core.FieldManager.FieldDataManager.GetFieldData(IPropertyInfo prop) in \Csla\Core\FieldManager\FieldDataManager.vb:line 113 at Csla.Core.BusinessBase.LoadProperty[P](PropertyInfo`1 propertyInfo, P newValue) in \Csla\Core\BusinessBase.vb:line 2236"

TargetSite: {System.Reflection.RuntimeMethodInfo}

?ex.GetBaseException

{"Index was outside the bounds of the array."}

System.IndexOutOfRangeException: {"Index was outside the bounds of the array."}

Data: {System.Collections.ListDictionaryInternal}

HelpLink: Nothing

InnerException: Nothing

Message: "Index was outside the bounds of the array."

Source: "Csla"

StackTrace: " at Csla.Core.FieldManager.FieldDataManager.GetFieldData(IPropertyInfo prop) in \Csla\Core\FieldManager\FieldDataManager.vb:line 110"

TargetSite: {System.Reflection.RuntimeMethodInfo}

JoeFallon1 replied on Wednesday, October 15, 2008

Did you implement the _dummy trick yet?

http://forums.lhotka.net/forums/2/26807/ShowThread.aspx

Joe

ward0093 replied on Wednesday, October 15, 2008

Thanks Joe... I thought I read through that post completely but I must not have understood the problem fully until now...

i got it now and since i have over 5 classes in the inhertance chain (outside the CSLA classes) i am going to go in and put the "Dummy Static Variable" in place..

i assume it is going to fix everything... so thank you!

ward0093

ward0093 replied on Wednesday, October 15, 2008

That worked!

Thanks, Joe

Copyright (c) Marimer LLC