How to convert sqldatareader to list of dto's?

前端 未结 3 1292
北荒
北荒 2021-01-22 03:28

I just started moving all my ado.net code from the asp.net pages to repo\'s and created dto\'s for each table (manually), but now I don\'t know what is a good efficient way to c

3条回答
  •  春和景丽
    2021-01-22 03:55

    You defenitly should look at Massive - this simple wrapper over ADO.NET

    var table = new Customer();
    //grab all
    var customers = table.All();
    //just grab from customer 4. This uses named parameters
    var customerFour = table.All(columns: "CustomerName as Name", where: "WHERE customerID=@0",args: 4);
    

提交回复
热议问题