Hi Telerik team,
i have a problem modelling a combination of association with horizontal inheritance.
My sample code is this:
publicclassParent{ publicintId { get; set; } publicstringTitle { get; set; } publicIList<ExecChild> ExecChildren { get; set; }}publicabstractclassExecChild{ publicString Title { get; set; } publicParent Parent { get; set; }}publicclassExecutor : ExecChild{ publicintId { get; set; } publicintNumber { get; set; }}publicclassMappingH{ publicstaticIEnumerable<MappingConfiguration> Configurations { get { var parent = newMappingConfiguration<Parent>(); parent.HasProperty(p => p.Id).IsIdentity(KeyGenerator.Autoinc); parent.HasAssociation(p => p.ExecChildren).WithOpposite(c => c.Parent); parent.MapType().ToTable("Parent"); yield returnparent; var execChild = newMappingConfiguration<ExecChild>(); execChild.MapType().Inheritance(InheritanceStrategy.Horizontal); yield returnexecChild; var executor = newMappingConfiguration<Executor>(); executor.HasProperty(d => d.Id).IsIdentity(KeyGenerator.Autoinc); executor.MapType(t => new { Id = t.Id, Number = t.Number }).ToTable("Executor"); yield returnexecutor; } }}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!