Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distinct Select #5

Open
deus82ex opened this issue Feb 5, 2019 · 1 comment
Open

Distinct Select #5

deus82ex opened this issue Feb 5, 2019 · 1 comment

Comments

@deus82ex
Copy link

deus82ex commented Feb 5, 2019

Hi,

can you please add the possibility of a distinct select?

Regards Mario

@mladenb
Copy link
Owner

mladenb commented Feb 10, 2019

Hi,

The more I think about it the more it seems to me that SelectAll() was not a good idea at all. I'm thinking of deleting it completely, because you can achieve the same results using Select(). But when using Select(), you have a freedom to specify the custom query you need, like:

var query = CreateSqlQueryBuilder()
	.From<User>()
	.Select(user => $"DISTINCT TOP 10 {user.Age}")
	.ToSqlQuery();

which would result in:

SELECT DISTINCT TOP 10 [User].[Age]
FROM [User]

So, Select() is already as flexible as needed to allow consumers to specify complex custom queries. Introducing SelectAll() was meant to be a convenient shortcut for Select(x => "*") but eventually it ended up being more of a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants