Nullable SetProperty

Nullable SetProperty

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


jfreeman posted on Friday, October 23, 2009

I am using version 3.5 and have a problem setting a nullable property to null. Here is my property declaration:

private static PropertyInfo(int?) ManagementCoIDProperty = RegisterProperty(int?)(typeof(CensusEdit), new PropertyInfo(int?)("ManagementCoID", new int?()));


Here is my set logic:

public int? ManagementCoID
{
get { return GetProperty(ManagementCoIDProperty); }
set { SetProperty(ManagementCoIDProperty, value); }
}

If the value being passed into my Property is null I get an error saying:

Property load or set failed for property ManagementCoID (Object reference not set to an instance of an object.)

I have tried everything I can think of but still cannot get it to Set the property. Load Property works fine but it does not fire the PropertyChanged event like I need it to. Thanks for any help.

Jonathan


Note: I changed the syntax in the property declaration so you could see it. For some reason I could not use a greater than and less than symbol in my post. So I replaced them with parenthesis.

ajj3085 replied on Friday, October 23, 2009

Hmm, I do this, and it works fine, but I have Csla 3.7.1  Might want to check if there's a change that fixes this.

Copyright (c) Marimer LLC