Timeline for How can I convert lambda expression with C#?
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 5, 2022 at 15:15 | comment | added | Svyatoslav Danyliv |
Show your entities. It is not clear why property names become filter by x.Key . It is possible to build/transfer any filter dynamically.
|
|
Feb 5, 2022 at 11:02 | comment | added | brk.gs | i want dont use complex query in generic repository. therefore i want create an extension methd. | |
Feb 5, 2022 at 7:33 | comment | added | Svyatoslav Danyliv | Strange sample. Do you need to generated dynamically such filter? | |
Feb 5, 2022 at 0:43 | answer | added | brk.gs | timeline score: 0 | |
Feb 4, 2022 at 23:49 | answer | added | T N | timeline score: 0 | |
Feb 4, 2022 at 21:35 | comment | added | brk.gs | i have a LanguageTranslate Table in database. Database scheme is Key-Value. Exc. L LanguageId =1 Key=ProductName Value=Water ProductTranslate class is not entity. it is translate content class. But i get only this class properties from database. I don't want to pull unnecessary records from the database where I don't need to use them. I will only pull the key values of the property in this class. there is no problem in this part. however, I wanted to set up such a structure because the query is very complex where I want to bring the contents of the language I want. | |
Feb 4, 2022 at 21:30 | history | edited | marc_s | CC BY-SA 4.0 |
added 141 characters in body; edited title
|
Feb 4, 2022 at 21:15 | comment | added | T N |
Side note: Consider whether you need to group the ShortDescription and Description conditions, so a Description match still requires a Productname match. What you have now is: (product-matches && Short-description-matches) || (description-matches) .
|
|
Feb 4, 2022 at 21:12 | comment | added | StriplingWarrior |
Welcome to StackOverflow. In order to get a better answer, please provide more details in your question. What is the starting generic type for your IQueryable<> ? Is it ProductTranslate ? What is the desired output type? Func<ProductTranslate, bool> ? Expression<Func<ProductTranslate, bool>> ? IQueryable<ProductTranslate> ? IQueryable<Dictionary<string, string>> ? Func<KeyValuePair<string, string>, bool> ?
|
|
Feb 4, 2022 at 21:10 | comment | added | T N |
Well first, for any given x, x.Key will never equal "ProductName", "ShortDescription", and "Description" all at the same time. What type do you expect for x? Is it a dictionary or associative array such that the expression would be something like x => x["ProductName"]=="product1" && x["ShortDescription"].Contains("short desc") || x["Description"].Contains("desc") ?
|
|
S Feb 4, 2022 at 21:00 | review | First questions | |||
Feb 5, 2022 at 0:47 | |||||
S Feb 4, 2022 at 21:00 | history | asked | brk.gs | CC BY-SA 4.0 |