'Using variable as database column in EF
How do I use a variable field to access data? I do not know which column I will be searching which is why this is neccessary
db.tbl.FirstOrDefault(r => r.(variable) == "live");
Solution 1:[1]
If you would like to select just one or a few properties which map to columns you can do the following;
var emails = context.Person.Select(x => new
{
x.Emails
});
This returns an collection of object with Email property.
Hope this helps
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | dijam |
