Select All Rows Using Entity Framework

asp.net entity-framework

Question

I'm trying to select all the rows out of a database using entity framework for manipulation before they're sent to the form

var ptx = [modelname].[tablename]();
ptx.[tablename].Select(????)

what goes in the ????

1
44
6/5/2012 3:30:10 PM

Accepted Answer

I used the entitydatasource and it provide everything I needed for what I wanted to do.

_repository.[tablename].ToList();

62
7/9/2013 12:57:48 PM

Popular Answer

Entity Framework has one beautiful thing for it, like :

var users = context.Users; 

This will select all rows in Table User, then you can use your .ToList() etc.


For newbies to Entity Framework, it is like :

PortalEntities context = new PortalEntities();
var users = context.Users;

This will select all rows in Table User



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