Discriminator values for abstract classes

Thread is closed for posting
2 posts, 0 answers
  1. Lars
    Lars avatar
    11 posts
    Member since:
    Oct 2015

    Posted 03 Dec 2015 Link to this post

    I have a class hierarchy which is mapped with InheritanceStrategy.Flat. It contains some abstract classes, for which instances cannot be inserted into the database. For concrete classes, I specified a human readable DiscriminatorValue.

    When looking at the generated SQL, I can see that it still includes generatd nuemerical discriminator values in the IN statement part for abstract classes, which naturally will never yield any result but could possibly slow the query down:

    SELECT ... FROM [TestStructure] a WHERE ... AND (a.[ChildType] IN ('1531407447', 'TestGroup', 'SkippedTestGroup', '654191631', ...))

    Is there any way to explicitly mark the abstract classes as "not storable" to circumvent this?


  2. Ralph Waldenmaier
    Ralph Waldenmaier avatar
    202 posts

    Posted 04 Dec 2015 Link to this post

    Hello Lars,
    Thank you for contacting us.
    I completely agree with you that the generated SQL statement could be optimized by omitting the class ids from the abstract class. As of now, we don't provide a mechanism to specify such a behavior nor do we have an implementation that would do this by its own.

    Feel free to add this request to our Ideas and Feedback portal to gather votes for this feature.

    Do not hesitate to get back to us in case you have any other question.

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