System.Linq.Dynamic.Core icon indicating copy to clipboard operation
System.Linq.Dynamic.Core copied to clipboard

support return Tuple

Open xieyufei1220 opened this issue 2 years ago • 1 comments

I want to pass the specified fields and then return tuple. It's ok with linq to db but error with EF 6. The exception is : Only parameterless constructors and initializers are supported in LINQ to Entities.

code:

async Task Main()
{
	Pick<(string, string)>("x=>new {x.AuthorCode,x.AuthorName}").Dump();  
}

public List<T> Pick<T>(string selector)
{
	return this.Author.Select<T>(selector).ToList();
}

can be improved to support return tuple as linq to db?

xieyufei1220 avatar May 25 '23 03:05 xieyufei1220

Related to https://github.com/zzzprojects/System.Linq.Dynamic.Core/issues/491

StefH avatar May 28 '23 20:05 StefH