M
Mark Henry
I've run into a strange problem that I'm having a difficult time
tracking down. I have no idea what's causing it, so this seemed as good
a place to ask as any...
If anyone is familiar with Neo (entity object framework), it deals with
that. Basically, I have two versions of the code.
version 1:
private readonly EnterpriseCodeValueDefinitionRelation
_enterpriseCodeValueDefinitions;
public EnterpriseCodeValueDefinitionRelation EnterpriseCodeValueDefinitions
{
get
{
return _enterpriseCodeValueDefinitions;
}
}
and version 2:
public readonly EnterpriseCodeValueDefinitionRelation
EnterpriseCodeValueDefinitions;
In each case, the readonly field is intialized in the ctor.
Version 1 works, whereas Version 2 produces really strange behavior
where a later ASP page ends up binding to incorrect data - the object
are of the wrong type (EnterpriseCodeValueDefinition instead of
EnterpriseCodeDefinition).
Basically, can anyone think of a scenario where accessing a field
through a property will cause different behavior then accessing the
field directly? Even if the field is readonly? And if anyone has Neo
experience, is this something specific to Neo (which wouldn't surprise
me in the least - I need to hunt down their mailing lists)?
-Mark-
tracking down. I have no idea what's causing it, so this seemed as good
a place to ask as any...
If anyone is familiar with Neo (entity object framework), it deals with
that. Basically, I have two versions of the code.
version 1:
private readonly EnterpriseCodeValueDefinitionRelation
_enterpriseCodeValueDefinitions;
public EnterpriseCodeValueDefinitionRelation EnterpriseCodeValueDefinitions
{
get
{
return _enterpriseCodeValueDefinitions;
}
}
and version 2:
public readonly EnterpriseCodeValueDefinitionRelation
EnterpriseCodeValueDefinitions;
In each case, the readonly field is intialized in the ctor.
Version 1 works, whereas Version 2 produces really strange behavior
where a later ASP page ends up binding to incorrect data - the object
are of the wrong type (EnterpriseCodeValueDefinition instead of
EnterpriseCodeDefinition).
Basically, can anyone think of a scenario where accessing a field
through a property will cause different behavior then accessing the
field directly? Even if the field is readonly? And if anyone has Neo
experience, is this something specific to Neo (which wouldn't surprise
me in the least - I need to hunt down their mailing lists)?
-Mark-