Select All Rows Using Entity Framework

asp.net entity-framework

Question

I'm attempting to use entity framework to retrieve all entries from a database for alteration before sending them to the form.

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

what is put in the???

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

Accepted Answer

I utilized the entitydatasource, and it provided all the information I need to complete my task.

_repository.[tablename].ToList();

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

Popular Answer

One lovely feature of Entity Framework includes:

var users = context.Users; 

This will choose every row in the table.User Afterwards, you can utilize your.ToList() etc.


When it comes to Entity Framework, it is similar to:

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

The following will appear 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