This is a migrated thread and some comments may be shown as answers.

Discriminator values for abstract classes

1 Answer 44 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lars
Top achievements
Rank 1
Lars asked on 03 Dec 2015, 10:35 AM

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?

 

1 Answer, 1 is accepted

Sort by
0
Ralph Waldenmaier
Telerik team
answered on 04 Dec 2015, 08:50 AM
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.

Regards,
Ralph Waldenmaier
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
Development (API, general questions)
Asked by
Lars
Top achievements
Rank 1
Answers by
Ralph Waldenmaier
Telerik team
Share this question
or