How SqlDataReader generates dynamic Lambda expressions
This article mainly introduces how SqlDataReader generates dynamic Lambda expressions. It is very detailed and has certain reference value. Friends who are interested must read it!
In the processing of the stream object SqlDataReader returned by SqlServer, the entity is also transformed by dynamically generating Lambda expressions.
First the previous version of the code
Using System;using System.Collections.Generic;using System.Data;using System.Data.Common;using System.Data.SqlClient;using System.Linq;using System.Linq.Expressions;using System.Reflection;using System.Text;using System.Threading.Tasks Namespace Demo1 {public static class EntityConverter {# region / DataTable generate entity / public static List ToList (this DataTable dataTable) where T: class, new () {if (dataTable = = null | | dataTable.Rows.Count 0) {cmd.Parameters.AddRange (pms);} conn.Open (); return cmd.ExecuteReader (CommandBehavior.CloseConnection);} class Usr {public Int32 ID {get; set } public String Name {get; set;}} above is all the content of the article "how SqlDataReader generates dynamic Lambda expressions". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!