This question is locked. New answers and comments are not allowed.
Hi,
My team is working with Open Access 2013.2.702.1 to build an ORM mapping against a legacy database. I have defined some classes with Horizontal inheritance, but I can't seem to add an association to the base class. I have gone over the forums looking for similar problems, and have based my approach on the discussion originally had in this thread, but I'm now getting an error that I can find no help for. I'd appreciate any insight anyone can offer.
The exception is:
I have created a minimal example that replicates the problem consistently. Here are my entities:
Here is my mapping, which is based on information from the thread I mentioned before (specifically, fully-qualifying the backing fields). I have experimented with explicitly providing all of the properties as expressions in the MapType() argument, but the same exception was still raised, so I left it out of this snippet to save space.
Thanks in advance.
My team is working with Open Access 2013.2.702.1 to build an ORM mapping against a legacy database. I have defined some classes with Horizontal inheritance, but I can't seem to add an association to the base class. I have gone over the forums looking for similar problems, and have based my approach on the discussion originally had in this thread, but I'm now getting an error that I can find no help for. I'd appreciate any insight anyone can offer.
The exception is:
Not implemented: Columns expressions is null, is this horizontal? (1)
at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQueryImpl(Type resultType, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single, Boolean checkOid)
at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQuery(Type type, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single, Boolean checkOid)
I have created a minimal example that replicates the problem consistently. Here are my entities:
public
class
Address
{
public
int
Id {
get
;
set
; }
public
string
AddressLine1 {
get
;
set
; }
public
string
City {
get
;
set
; }
public
string
Province {
get
;
set
; }
public
string
Country {
get
;
set
; }
public
string
PostalCode {
get
;
set
; }
// Foreign Keys
public
int
EntityId {
get
;
set
; }
}
public
class
Entity
{
private
IList<Address> addresses =
new
List<Address>();
public
int
Id {
get
;
set
; }
public
IList<Address> Addresses
{
get
{
return
addresses; }
set
{ addresses = value; }
}
}
public
class
Individual : Entity
{
public
string
NameFirst {
get
;
set
; }
public
string
NameLast {
get
;
set
; }
}
public
class
Organization : Entity
{
public
string
Name {
get
;
set
; }
}
Here is my mapping, which is based on information from the thread I mentioned before (specifically, fully-qualifying the backing fields). I have experimented with explicitly providing all of the properties as expressions in the MapType() argument, but the same exception was still raised, so I left it out of this snippet to save space.
protected
override
IList<MappingConfiguration> PrepareMapping()
{
List<MappingConfiguration> configurations =
new
List<MappingConfiguration>();
var address =
new
MappingConfiguration<Address>();
address.MapType().ToTable(
"Addresses"
);
address.HasProperty(a => a.Id).IsIdentity(KeyGenerator.Autoinc);
configurations.Add(address);
var entity =
new
MappingConfiguration<Entity>();
entity.MapType().Inheritance(InheritanceStrategy.Horizontal);
configurations.Add(entity);
var individual =
new
MappingConfiguration<Individual>();
individual.MapType().ToTable(
"Individuals"
);
individual.HasProperty(i => i.Id).IsIdentity(KeyGenerator.Autoinc);
individual.HasAssociation(i => i.Addresses).HasFieldName(
"Entity.addresses"
).ToColumn(
"EntityId"
);
configurations.Add(individual);
var organization =
new
MappingConfiguration<Organization>();
organization.MapType().ToTable(
"Organizations"
);
organization.HasProperty(o => o.Id).IsIdentity(KeyGenerator.Autoinc);
organization.HasAssociation(o => o.Addresses).HasFieldName(
"Entity.addresses"
).ToColumn(
"EntityId"
);
configurations.Add(organization);
return
configurations;
}
Thanks in advance.