I've been able to obtain the column names from an entity using the answer for the query at Entity Framework - getting a table's column names as a string array (thanks dav_i!).
My array is obtained from
var colNames = typeof(User).GetProperties().Select(a => a.Name).ToArray();
My question is, how do I use this array of column names to specify particular values in the DbPropertyValues collection of my entity?
I have used the following C# code to previously attempt to work through the collection -
DbPropertyValues values = dbContext.Entry(item).CurrentValues;
foreach (var propName in values.PropertyNames)
{
...
However, what I really need is to be able to specify something like this -
for(int i = 5; i < 11; i++)
{
var colValue = values(colNames[i]);
I want to use the array index to help select particular entity property values. Should I be using something other than DbPropertyValues?
This was so easy with ADO.Net, using DataRow[i]....
Can anyone help?