Question title could be confusing because i didn't find appropriate sentence to specify my problem. I have an entity which contains 60 properties [Columns]. Now i want to insert into this entity. Normal insert code would be:
tblEmployee objEmployee= new tblEmployee();
tblEmplyee.Name="abc"; // Col 1
tblEmplyee.Email="[email protected]"; // Col 2
tblEmplyee.S1="s1"; // Col 3
tblEmplyee.S2="s2"; // Col 4
.
.
.
tblEmplyee.S60="s60"; // Col 60
db.AddTotblEmployee(objEmployee);
db.SaveChanges();
But i have a condition, i need to insert values in S1 to S60 variably. e.g case 1: from S1 to S17 value 1, S18 to S50 value 2 and S51 to S60 value 3. case 2: from S1 to S11 value 1, S11 to S40 value 2, S40 to S43 value 3 and S44 to S60 value 4.
And this pattern can be different every time and depend on user input by UI.
Is there any way to access tblEmployee's column like array indexes ?
tblEmployee objEmployee= new tblEmployee();
tblEmplyee.col["1"]="abc"; // Col 1
tblEmplyee.col["2"]="[email protected]"; // Col 2
tblEmplyee.col["3"]="s1"; // Col 3
.
.
.
or any other way?