The following code prints 2:

new MyEntity();
new MyEntity();
var distinctTypes = Query.All<MyEntity>()
    .Select(it => it.GetType())
    .Distinct()
    .Count();
Console.WriteLine(distinctTypes);

It executes sql query with distinct on Id and TypeId:

SELECT COUNT_BIG(*) AS [c01umn] FROM (SELECT DISTINCT [a].[Id], 100 AS [TypeId] FROM [dbo].[MyEntity] [a]) [b];

asked May 22 at 06:41

Platonov's gravatar image

Platonov
5256

Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×5
×1
×1

Asked: May 22 at 06:41

Seen: 554 times

Last updated: May 22 at 06:41

powered by OSQA