Using associations in combination with horizontal inheritance

Thread is closed for posting
3 posts, 0 answers
  1. Catalin
    Catalin avatar
    8 posts
    Member since:
    Jun 2015

    Posted 16 Jul 2015 Link to this post

    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
          var parent = new MappingConfiguration<Parent>();
          parent.HasProperty(p => p.Id).IsIdentity(KeyGenerator.Autoinc);
          parent.HasAssociation(p => p.ExecChildren).WithOpposite(c => c.Parent);
          yield return parent;
          var execChild = new MappingConfiguration<ExecChild>();
          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
          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?





  2. Catalin
    Catalin avatar
    8 posts
    Member since:
    Jun 2015

    Posted 17 Jul 2015 in reply to Catalin Link to this post

    Not need to replay, I found the answer here:


  3. Ady
    Ady avatar
    589 posts

    Posted 21 Jul 2015 Link to this post

    Hi Catalin,

     Glad you found the reply.
    Do get back in case you need further assistance.

    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Back to Top