List<Student> students = new List<Student>(){ new Student(){Id=0,Name="Tim",Age=20, ··· } } this.listBoxStudents.ItemsSource= students; this.listBoxStudents.DisplayMemberPath="Name";//此属性被赋值后会自动创建Path赋值创 Binding。 Binding binding = new Binding("SelectedItem.Id"){Source=listBoxStudents}; this.textBox1.SetBinding(TextBox.TextProperty,binding);
再来看看另外一个扩展方法,这个同样使用了RequestDelegate,但是只传入了RequestDelegate,没有传出这个类,这是作为最后一个中间件的写法,用于实际处理业务需求,如摘要所写(Adds a terminal middleware delegate to the application’s request pipeline.)。
namespaceMicrosoft.AspNetCore.Http { // // 摘要: // A function that can process an HTTP request. // // 参数: // context: // The Microsoft.AspNetCore.Http.HttpContext for the request. // // 返回结果: // A task that represents the completion of request processing. publicdelegate Task RequestDelegate(HttpContext context); }
publicinterfaceIApplicationBuilder { // // 摘要: // Adds a middleware delegate to the application's request pipeline. // // 参数: // middleware: // The middleware delegate. // // 返回结果: // The Microsoft.AspNetCore.Builder.IApplicationBuilder. IApplicationBuilder Use(Func<RequestDelegate, RequestDelegate> middleware); }
上面这种中间用来进行中间件间的转发,里面根据业务情况来决定处理请求发给哪个中间件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
publicstaticclassUseExtensions { // // 摘要: // Adds a middleware delegate defined in-line to the application's request pipeline. // // 参数: // app: // The Microsoft.AspNetCore.Builder.IApplicationBuilder instance. // // middleware: // A function that handles the request or calls the given next function. // // 返回结果: // The Microsoft.AspNetCore.Builder.IApplicationBuilder instance. publicstatic IApplicationBuilder Use(this IApplicationBuilder app, Func<HttpContext, Func<Task>, Task> middleware); }
作为终端的中间件
1 2 3 4 5 6 7
publicvoidConfigure(IApplicationBuilder app, IWebHostEnvironment env) { app.Run(async context => { await context.Response.WriteAsync("This is a middleware"); }); }
8、Inactivating prepared statementsUse this one to instruct the provider to ignore any command prepare statements and prevent corruption issues with server side prepared statements.此选项被加入到Connector/NET的5.0.3版和1.0.9版。
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Ignore Prepare=true;
1、标准连接
User ID=root;Password=myPassword;Host=localhost;Port=3306;Database=myDataBase; Direct=true;Protocol=TCP;Compress=false;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;
DELETE FROM tablename WHERE tab_col NOTIN( SELECT dt.minno FROM( SELECTMIN(tab_col) AS minno FROM tablename WHERE col1 =1AND col2 =2 GROUPBY col3 ) dt ) AND col1 =1AND col2 =2