This question is locked. New answers and comments are not allowed.
Hi Telerik team,
i have a problem modelling a combination of association with horizontal inheritance.
My sample code is this:
public class Parent{ public int Id { get; set; } public string Title { get; set; } public IList<ExecChild> ExecChildren { get; set; }}public abstract class ExecChild{ public String Title { get; set; } public Parent Parent { get; set; }}public class Executor : ExecChild{ public int Id { get; set; } public int Number { get; set; }}public class MappingH{ public static IEnumerable<MappingConfiguration> Configurations { get { var parent = new MappingConfiguration<Parent>(); parent.HasProperty(p => p.Id).IsIdentity(KeyGenerator.Autoinc); parent.HasAssociation(p => p.ExecChildren).WithOpposite(c => c.Parent); parent.MapType().ToTable("Parent"); yield return parent; var execChild = new MappingConfiguration<ExecChild>(); execChild.MapType().Inheritance(InheritanceStrategy.Horizontal); yield return execChild; var executor = new MappingConfiguration<Executor>(); executor.HasProperty(d => d.Id).IsIdentity(KeyGenerator.Autoinc); executor.MapType(t => new { Id = t.Id, Number = t.Number }).ToTable("Executor"); yield return executor; } }}The code compiles without any problem, but at the run-time at the line creating the DDL script:
script = schemaHandler.CreateUpdateDDLScript(null);at get this exception:
An unhandled exception of type 'Telerik.OpenAccess.Exceptions.MetadataException' occurred in Telerik.OpenAccess.dll
Additional information: Failed to create main table indexes of class 'ExecChild'.
Can you help me with this problem?
How to map this kind of structure to a DB using horizontal inheritance?
Thanks!