Select All Rows Using Entity Framework

前端 未结 8 508
无人共我
无人共我 2021-02-01 00:48

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]()         


        
8条回答
  •  清酒与你
    2021-02-01 01:35

    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

提交回复
热议问题