FieldDataManager getting wrong field?

FieldDataManager getting wrong field?

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


ajj3085 posted on Monday, December 15, 2008

Hi,

I'm getting an exception which I can't figure out.  I have a PropertyInfo<string>, named PartNumber in a BB subclass.  I also have some other managed properties.  For some reason, when the PartNumberProperty is used in GetProperty, the FieldDataManager is returning the UnitPriceProperty.  protected P ReadProperty<P>(PropertyInfo<P> propertyInfo) in BB then fails, because it can't case the decimal data type to a string.

What's going on?

sergeyb replied on Monday, December 15, 2008

I think there was a thread recently regarding this.  I believe it boiled down to not having static _dummy variable in all classes.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Monday, December 15, 2008 1:05 PM
To: Sergey Barskiy
Subject: [CSLA .NET] FieldDataManager getting wrong field?

 

Hi,

I'm getting an exception which I can't figure out.  I have a PropertyInfo<string>, named PartNumber in a BB subclass.  I also have some other managed properties.  For some reason, when the PartNumberProperty is used in GetProperty, the FieldDataManager is returning the UnitPriceProperty.  protected P ReadProperty<P>(PropertyInfo<P> propertyInfo) in BB then fails, because it can't case the decimal data type to a string.

What's going on?


ajj3085 replied on Monday, December 15, 2008

Hmm, I don't remember it. I'll give that a shot... I'm surprised I've been able to avoid this issue for so long.

ajj3085 replied on Monday, December 15, 2008

Thanks, it looks like that was the fix.

I'm a bit surprised, because the fields in question were defined on the derived class anyway.. nothing to do with the fields defined in the base class.

Anyway, I'm glad it's working now.. thanks again!

sergeyb replied on Monday, December 15, 2008

The issue is that your indexes for property info objects would collide without that, that is what you were running into.  You had two properties with index X – one in base class and the other in inherited class.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Monday, December 15, 2008 1:39 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: FieldDataManager getting wrong field?

 

Thanks, it looks like that was the fix.

I'm a bit surprised, because the fields in question were defined on the derived class anyway.. nothing to do with the fields defined in the base class.

Anyway, I'm glad it's working now.. thanks again!


ajj3085 replied on Monday, December 15, 2008

That makes sense; I just converted the base class to use managed properties with private backing fields. Previously, they didn't do anything but directly return the value.

Copyright (c) Marimer LLC