the error occurs in CPersistentBroker Reflect(..) :
"If Not afTable.KeyReference Is Nothing And Not afTable.SuperClass Is Nothing Then
refAttr = ClassMap.SuperClass.getAttributeMapByString(afTable.KeyReference, True)..."
But ClassMap.Superclass instance is not set yet(= nothing)
-> Error:"Object reference not set to an instance of an object."
Lene
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've tried to persist inheritance by using attributes, but I dont know how to use it correct:
My SUPERCLASS:
[AFTable("MyBusinessObjects", "Test", AFTableAttribute.KeyType.useOIDValue,
OIDColumn="oid", CreatedTimestamp="CreatedDate", ModifiedTimestamp="ModifiedDate")]
public class MyBusinessObject : CPersistentObject
{...}
SUBCLASS:
[AFTable("MyBusinessObjects",
"Test",
AFTableAttribute.KeyType.useOIDValue,
OIDColumn="oid",
SuperClass=typeof(MyBusinessObject),
KeyReference="OIDValue", SharedTableField="IType", SharedTableValue="1")]
public class MyBusinessObject1 : MyBusinessObject
{...}
Is there something wrong?? because I get the error:
"Object reference not set to an instance of an object."
Thanks and Regards
Lene
Hi Lene,
The code looks OK at first glance. Have you isolated the line of code that actually causes the error?
- Richard.
Hi Richard,
the error occurs in CPersistentBroker Reflect(..) :
"If Not afTable.KeyReference Is Nothing And Not afTable.SuperClass Is Nothing Then
refAttr = ClassMap.SuperClass.getAttributeMapByString(afTable.KeyReference, True)..."
But ClassMap.Superclass instance is not set yet(= nothing)
-> Error:"Object reference not set to an instance of an object."
Lene
Ah. Got it :-)
Please get the latest version of CPersistenceBroker from CVS and try that. It should be OK now.
Please note that the public CVS takes a little while to update.