Iterating through entity object in entity framework

c# datatable entity-framework

Question

I'am pretty new to Entity Framework(started about a week ago) and I've been looking around for solution to what I think is a simple problem for a day now,

"I have extracted data from table but before I bind it to repeater I want to do some enhancements to data like combine data from 2 columns and as such , so what I'm asking is, is there a way to iterate through data(columns) in an entity object?"

I tried a lot but couldn't find an answer so I had to use reflection to convert my entity object into datatable and do manipulations using "datatable.rows[row_no][col_no]" ... but I find this way really stupid ..I mean what's the point of using an ORM if you have to use datatables...so is there a way of iterating like datatables in EF-object. Like:

dbtest1entities db = new  dbtest1entities();//"dbtest1entities " is like database
var info = db.mp_data;//"mp_data" is the table i want to fetch data from.

Question: Can I iterate through data in var info row and column-wise.

Kindly help in this regard.(CANT GOOGLE ANYMORE!!!!!!)

1
0
12/9/2013 11:50:59 AM

Accepted Answer

BD.Entities model = new BD.Entities();

var gg = model.ALUNOS;

foreach (var i in gg)
{
   string teste = i.NOME;
}
6
12/9/2013 12:07:07 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow