This question is locked. New answers and comments are not allowed.
Hello all,
Open Access:2012.1.214
Visual Studio: 2010 SP1
Method: Fluent
We try to set/get the value of the artificial field "Age" of the class Person from the Open Access documentation:
For this, in the mapping of Person class, the artificial field "Age" is added:
Now, we want to set a value for this field "Age" in an instance of the class "Person": We use the new extension SetFieldValue added in the Q12 of Open Access:
Open Access throws an exception:
What is missing in our code to set/get correctly value of artificial fields with CLR types in code-only?
Note; same exception for FieldValue()
Thank you,
Alain
Open Access:2012.1.214
Visual Studio: 2010 SP1
Method: Fluent
We try to set/get the value of the artificial field "Age" of the class Person from the Open Access documentation:
Public Class Person Private _id As Integer Public Property Id() As Integer Get Return _id End Get Set(ByVal value As Integer) _id = value End Set End Property Private _firstName As String Public Property FirstName() As String Get Return _firstName End Get Set(ByVal value As String) _firstName = value End Set End Property Private _lastName As String Public Property LastName() As String Get Return _lastName End Get Set(ByVal value As String) _lastName = value End Set End Property Private _address As String Public Property Address() As String Get Return _address End Get Set(ByVal value As String) _address = value End Set End PropertyEnd ClassFor this, in the mapping of Person class, the artificial field "Age" is added:
Dim personConfiguraiton As
New MappingConfiguration(Of Person)()
...personConfiguraiton.HasArtificialPrimitiveProperty(Of Integer)("Age")Now, we want to set a value for this field "Age" in an instance of the class "Person": We use the new extension SetFieldValue added in the Q12 of Open Access:
Dim nPerson as New PersonnPerson.SetFieldValue("Age", 12)Open Access throws an exception:
PersistenceCapable instance is not managed by an IObjectScope.Parameter name: persistentInstanceWhat is missing in our code to set/get correctly value of artificial fields with CLR types in code-only?
Note; same exception for FieldValue()
Thank you,
Alain