.net  core中有哪些被抛弃的类

1、DataTable DataRow SqlDataAdapter DataRow DataColumn DataColumn

虽然这些类不是我ORM核心功能,但是为了保证非Core版本的ORM和Core的语法要一致方便以后升级

于是我就有了一个想法将他们复活,打造一个小巧的DataTable,让更多的老程可以方便的移植到Core。

    /// <summary>
/// 作者:sunkaixuan
/// 创建时间:2016/7/31
/// 修改时间:-
/// 说明:让.netCore支持DataTable
/// </summary>
public class DataTable
{
public DataColumnCollection Columns = new DataColumnCollection(); public DataRowCollection Rows = new DataRowCollection();
}
public class DataColumn
{
public DataColumn()
{ }
public DataColumn(string columnName)
{
this.ColumnName = columnName;
}
public DataColumn(string columnName, object dataType)
{
this.ColumnName = columnName;
this.DataType = dataType;
}
public string ColumnName { get; internal set; }
public object DataType { get; internal set; }
}
  public class DataColumnCollection : IEnumerable, ICollection, IEnumerator
{
public DataColumn this[int thisIndex]
{
get
{
return cols[thisIndex];
}
}
private int index = -;
private List<DataColumn> cols;
public int Count
{
get
{
if (this.cols == null)
{
this.cols = new List<DataColumn>();
}
return this.cols.Count;
}
} public void Add(DataColumn col)
{
if (this.cols == null)
{
this.cols = new List<DataColumn>();
}
this.cols.Add(col);
} public bool IsSynchronized
{
get
{
return true;
}
} public object SyncRoot
{
get
{
return null;
}
} public object Current
{
get
{
return cols[index];
}
} public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
} //
// 摘要:
// 获取该集合的 System.Collections.IEnumerator。
//
// 返回结果:
// 该集合的 System.Collections.IEnumerator。
public IEnumerator GetEnumerator()
{
return (IEnumerator)this; ;
} public bool MoveNext()
{
index++;
var isNext = index < cols.Count;
if (!isNext)
Reset();
return isNext;
} public void Reset()
{
index = -;
} public bool ContainsKey(string name)
{
if (this.cols == null) return false;
return (this.cols.Any(it => it.ColumnName == name));
}
}
  public class DataRowCollection : IEnumerable, ICollection, IEnumerator
{ public DataRow this[int thisIndex]
{
get
{
return Rows[thisIndex];
}
} private int index = -;
private List<DataRow> Rows = null;
public int Count
{
get
{
if (this.Rows == null)
{
this.Rows = new List<DataRow>();
}
return Rows.Count;
}
} public object Current
{
get
{
if (this.Rows == null)
{
this.Rows = new List<DataRow>();
}
return Rows[index];
}
} public bool IsSynchronized
{
get
{
return true;
}
} public object SyncRoot
{
get
{
return null;
}
} public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
} //
// 摘要:
// 获取该集合的 System.Collections.IEnumerator。
//
// 返回结果:
// 该集合的 System.Collections.IEnumerator。
public IEnumerator GetEnumerator()
{
return (IEnumerator)this; ;
} public bool MoveNext()
{
index++;
var isNext = index < Rows.Count;
if (!isNext)
Reset();
return isNext;
} public void Reset()
{
index = -;
} internal void Add(DataRow daRow)
{
if (Rows == null)
{
Rows = new List<DataRow>();
}
Rows.Add(daRow);
}
} public class DataRow
{
private Dictionary<string, object> obj = new Dictionary<string, object>(); public void Add(string key, object value)
{
obj.Add(key, value);
} public object this[string name]
{
get
{
return obj[name];
}
}
public object this[int index]
{
get
{
int i = ;
object reval = null;
foreach (var item in obj)
{
if (i == index)
{
reval = item.Value;
break;
}
i++;
}
return reval;
}
} public bool ContainsKey(string columnName)
{
if (this.obj == null) return false;
return (this.obj.ContainsKey(columnName));
}
} public class SqlDataAdapter
{
private SqlCommand command;
private string sql;
private SqlConnection _sqlConnection; public SqlDataAdapter(SqlCommand command)
{
this.command = command;
} public SqlDataAdapter(string sql, SqlConnection _sqlConnection)
{
this.sql = sql;
this._sqlConnection = _sqlConnection;
} public SqlCommand SelectCommand
{
get
{
if (this.command == null)
{
this.command = new SqlCommand(this.sql, this._sqlConnection);
}
return this.command;
}
} public void Fill(DataTable dt)
{
if (dt == null)
{
dt = new DataTable();
}
var columns = dt.Columns;
var rows = dt.Rows;
using (SqlDataReader dr = command.ExecuteReader())
{
for (int i = ; i < dr.FieldCount; i++)
{
string name = dr.GetName(i).Trim();
if (!columns.ContainsKey(name))
columns.Add(new DataColumn(name, dr.GetFieldType(i)));
} while (dr.Read())
{
DataRow daRow = new DataRow();
for (int i = ; i < columns.Count; i++)
{
if (!daRow.ContainsKey(columns[i].ColumnName))
daRow.Add(columns[i].ColumnName, dr.GetValue(i));
}
dt.Rows.Add(daRow);
}
} }
}

DataRowCollection SqlDataAdapter DataRow

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data; namespace SqlSugar
{
/// <summary>
/// ** 描述:底层SQL辅助函数
/// ** 创始时间:2015-7-13
/// ** 修改时间:-
/// ** 作者:sunkaixuan
/// ** 使用说明:
/// </summary>
public class SqlHelper : IDisposable
{
SqlConnection _sqlConnection;
SqlTransaction _tran = null;
/// <summary>
/// 是否清空SqlParameters
/// </summary>
public bool isClearParameters = true;
public int CommandTimeOut = ;
/// <summary>
/// 将页面参数自动填充到SqlParameter [],无需在程序中指定,这种情况需要注意是否有重复参数
/// 例如:
/// var list = db.Queryable《Student》().Where("id=@id").ToList();
/// 以前写法
/// var list = db.Queryable《Student》().Where("id=@id", new { id=Request["id"] }).ToList();
/// </summary>
public bool IsGetPageParas = false;
public SqlHelper(string connectionString)
{
_sqlConnection = new SqlConnection(connectionString);
_sqlConnection.Open();
}
public SqlConnection GetConnection()
{
return _sqlConnection;
}
public void BeginTran()
{
_tran = _sqlConnection.BeginTransaction();
} public void BeginTran(IsolationLevel iso)
{
_tran = _sqlConnection.BeginTransaction(iso);
} public void BeginTran(string transactionName)
{
_tran = _sqlConnection.BeginTransaction(transactionName);
} public void BeginTran(IsolationLevel iso, string transactionName)
{
_tran = _sqlConnection.BeginTransaction(iso, transactionName);
} public void RollbackTran()
{
if (_tran != null)
{
_tran.Rollback();
_tran = null;
}
}
public void CommitTran()
{
if (_tran != null)
{
_tran.Commit();
_tran = null;
}
}
public string GetString(string sql, object pars)
{
return GetString(sql, SqlSugarTool.GetParameters(pars));
}
public string GetString(string sql, params SqlParameter[] pars)
{
return Convert.ToString(GetScalar(sql, pars));
}
public int GetInt(string sql, object pars)
{
return GetInt(sql, SqlSugarTool.GetParameters(pars));
}
public int GetInt(string sql, params SqlParameter[] pars)
{
return Convert.ToInt32(GetScalar(sql, pars));
}
public object GetScalar(string sql, object pars)
{
return GetScalar(sql, SqlSugarTool.GetParameters(pars));
}
public object GetScalar(string sql, params SqlParameter[] pars)
{
SqlCommand sqlCommand = new SqlCommand(sql, _sqlConnection);
if (_tran != null)
{
sqlCommand.Transaction = _tran;
}
sqlCommand.CommandTimeout = this.CommandTimeOut;
if (pars != null)
sqlCommand.Parameters.AddRange(pars);
if (IsGetPageParas)
{
SqlSugarToolExtensions.RequestParasToSqlParameters(sqlCommand.Parameters);
}
object scalar = sqlCommand.ExecuteScalar();
scalar = (scalar == null ? : scalar);
sqlCommand.Parameters.Clear();
return scalar;
}
public int ExecuteCommand(string sql, object pars)
{
return ExecuteCommand(sql, SqlSugarTool.GetParameters(pars));
}
public int ExecuteCommand(string sql, params SqlParameter[] pars)
{
SqlCommand sqlCommand = new SqlCommand(sql, _sqlConnection);
sqlCommand.CommandTimeout = this.CommandTimeOut;
if (_tran != null)
{
sqlCommand.Transaction = _tran;
}
if (pars != null)
sqlCommand.Parameters.AddRange(pars);
if (IsGetPageParas)
{
SqlSugarToolExtensions.RequestParasToSqlParameters(sqlCommand.Parameters);
}
int count = sqlCommand.ExecuteNonQuery();
sqlCommand.Parameters.Clear();
return count;
}
public SqlDataReader GetReader(string sql, object pars)
{
return GetReader(sql, SqlSugarTool.GetParameters(pars));
}
public SqlDataReader GetReader(string sql, params SqlParameter[] pars)
{
SqlCommand sqlCommand = new SqlCommand(sql, _sqlConnection);
sqlCommand.CommandTimeout = this.CommandTimeOut;
if (_tran != null)
{
sqlCommand.Transaction = _tran;
}
if (pars != null)
sqlCommand.Parameters.AddRange(pars);
if (IsGetPageParas)
{
SqlSugarToolExtensions.RequestParasToSqlParameters(sqlCommand.Parameters);
}
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
if (isClearParameters)
sqlCommand.Parameters.Clear();
return sqlDataReader;
}
public List<T> GetList<T>(string sql, object pars)
{
return GetList<T>(sql, SqlSugarTool.GetParameters(pars));
}
public List<T> GetList<T>(string sql, params SqlParameter[] pars)
{
var reval = SqlSugarTool.DataReaderToList<T>(typeof(T), GetReader(sql, pars), null);
return reval;
}
public T GetSingle<T>(string sql, object[] pars)
{
return GetSingle<T>(sql, SqlSugarTool.GetParameters(pars));
}
public T GetSingle<T>(string sql, params SqlParameter[] pars)
{
var reval = SqlSugarTool.DataReaderToList<T>(typeof(T), GetReader(sql, pars), null).Single();
return reval;
}
public DataTable GetDataTable(string sql, object pars)
{
return GetDataTable(sql, SqlSugarTool.GetParameters(pars));
}
public DataTable GetDataTable(string sql, params SqlParameter[] pars)
{
SqlDataAdapter _sqlDataAdapter = new SqlDataAdapter(sql, _sqlConnection);
_sqlDataAdapter.SelectCommand.Parameters.AddRange(pars);
if (IsGetPageParas)
{
SqlSugarToolExtensions.RequestParasToSqlParameters(_sqlDataAdapter.SelectCommand.Parameters);
}
_sqlDataAdapter.SelectCommand.CommandTimeout = this.CommandTimeOut;
if (_tran != null)
{
_sqlDataAdapter.SelectCommand.Transaction = _tran;
}
DataTable dt = new DataTable();
_sqlDataAdapter.Fill(dt);
_sqlDataAdapter.SelectCommand.Parameters.Clear();
return dt;
} public void Dispose()
{
if (_sqlConnection != null)
{
if (_sqlConnection.State != ConnectionState.Closed)
{
if (_tran != null)
_tran.Commit();
_sqlConnection.Close();
}
}
}
}
}

配套的SqlHelper

2.GetType的扩展属性发生变更

例如 Type.IsEnum在Core中要写成 Type.GetTypeInfo().IsEnum

于是我将代码进行封装,让语法不变

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
namespace SqlSugar
{
public static class TypeExtensions
{
public static PropertyInfo[] GetProperties(this Type type)
{
var reval = type.GetTypeInfo().GetProperties();
return reval;
}
public static PropertyInfo GetProperty(this Type type, string name)
{
var reval = type.GetTypeInfo().GetProperty(name);
return reval;
} public static FieldInfo GetField(this Type type, string name)
{
var reval = type.GetTypeInfo().GetField(name);
return reval;
} public static bool IsEnum(this Type type)
{
var reval = type.GetTypeInfo().IsEnum;
return reval;
} public static MethodInfo GetMethod(this Type type, string name)
{
var reval = type.GetTypeInfo().GetMethod(name);
return reval;
}
public static MethodInfo GetMethod(this Type type, string name, Type[] types)
{
var reval = type.GetTypeInfo().GetMethod(name, types);
return reval;
}
public static ConstructorInfo GetConstructor(this Type type, Type[] types)
{
var reval = type.GetTypeInfo().GetConstructor(types);
return reval;
}
}
}

3、System.Web类

因为SqlSugar ORM并没有用到System.Web的功能,所以基本没什么事儿

SqlSugar一款轻量级高性能ORM框架 Core版只有80K功能强大

将Demo进行了整理方便大家使用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SqlSugar;
using SqlSugarTest.Demos; namespace SqlSugarTest
{
public class Program
{
public static void Main(string[] args)
{ using (SqlSugarClient db = new SqlSugarClient("server=.;uid=sa;pwd=sasa;database=SqlSugarTest"))
{
var dt = db.GetDataTable("select * from student where id=@id", new { id = }); //设置执行的DEMO
string switch_on = "EnumType"; IDemos demo = null;
switch (switch_on)
{
//ADO.NET基本功能
case "Ado": demo = new Ado(); break;
//查询
case "Select": demo = new Select(); break;
//插入
case "Insert": demo = new Insert(); break;
//更新
case "Update": demo = new Update(); break;
//删除
case "Delete": demo = new Delete(); break;
//事务
case "Tran": demo = new Tran(); break;
//生成实体
case "CreateClass": demo = new CreateClass(); break;
//枚举类型的支持
case "EnumType": demo = new EnumType(); break; //除了多库并行计算外的所有功能都已经移植成功更多例子请关注我的博客 }
//执行DEMO
demo.Init(); Console.WriteLine("执行成功请关闭窗口");
Console.ReadKey();
}
}
}
}

目录更加简洁明了

查询:

using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; namespace SqlSugarTest.Demos
{
public class Select:IDemos
{
public void Init()
{ //单表查询
QueryableDemo(); //多表查询
SqlableDemo(); //Sql查询
SqlQuery(); //新容器转换
NewSelect(); } /// <summary>
/// 新容器转换
/// </summary>
private void NewSelect()
{ using (SqlSugarClient db = SugarDao.GetInstance())
{
var list2 = db.Queryable<Student>().Where(c => c.id < 10).Select(c => new classNew { newid = c.id, newname = c.name, xx_name = c.name }).ToList();//不支持匿名类转换,也不建议使用 var list3 = db.Queryable<Student>().Where(c => c.id < 10).Select(c => new { newid = c.id, newname = c.name, xx_name = c.name }).ToDynamic();//匿名类转换
}
}
/// <summary>
/// Sql查询
/// </summary>
private void SqlQuery()
{
using (var db = SugarDao.GetInstance())
{
//转成list
List<Student> list1 = db.SqlQuery<Student>("select * from Student");
//转成list带参
List<Student> list2 = db.SqlQuery<Student>("select * from Student where id=@id", new { id = 1 });
//转成dynamic
dynamic list3 = db.SqlQueryDynamic("select * from student");
//转成json
string list4 = db.SqlQueryJson("select * from student");
//返回int
var list5 = db.SqlQuery<int>("select top 1 id from Student").Single();
//反回键值
Dictionary<string, string> list6 = db.SqlQuery<KeyValuePair<string, string>>("select id,name from Student").ToDictionary(it => it.Key, it => it.Value);
//反回List<string[]>
var list7 = db.SqlQuery<string[]>("select top 1 id,name from Student").Single();
//存储过程
var spResult = db.SqlQuery<School>("exec sp_school @p1,@p2", new { p1 = 1, p2 = 2 });
}
}
/// <summary>
/// 多表查询
/// </summary>
private void SqlableDemo()
{
using (var db = SugarDao.GetInstance())
{
//---------Sqlable,创建多表查询---------// //多表查询
List<School> dataList = db.Sqlable()
.From("school", "s")
.Join("student", "st", "st.id", "s.id", JoinType.INNER)
.Join("student", "st2", "st2.id", "st.id", JoinType.LEFT)
.Where("s.id>100 and s.id<@id")
.Where("1=1")//可以多个WHERE
.SelectToList<School/*新的Model我这里没有所以写的School*/>("st.*", new { id = 1 }); //多表分页
List<School> dataPageList = db.Sqlable()
.From("school", "s")
.Join("student", "st", "st.id", "s.id", JoinType.INNER)
.Join("student", "st2", "st2.id", "st.id", JoinType.LEFT)
.Where("s.id>100 and s.id<100")
.SelectToPageList<School>("st.*", "s.id", 1, 10); //多表分页WHERE加子查询
List<School> dataPageList2 = db.Sqlable()
.From("school", "s")
.Join("student", "st", "st.id", "s.id", JoinType.INNER)
.Join("student", "st2", "st2.id", "st.id", JoinType.LEFT)
.Where("s.id>100 and s.id<100 and s.id in (select 1 )" /*这里面写子查询都可以*/)
.SelectToPageList<School>("st.*", "s.id", 1, 10); //--------转成List Dynmaic 或者 Json-----// //不分页
var list1 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToDynamic("*", new { id = 1 });
var list2 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToJson("*", new { id = 1 });
var list3 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToDataTable("*", new { id = 1 }); //分页
var list4 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToPageDynamic("s.*", "l.id", 1, 10, new { id = 1 });
var list5 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToPageTable("s.*", "l.id", 1, 10, new { id = 1 });
var list6 = db.Sqlable().From("student", "s").Join("school", "l", "s.sch_id", "l.id and l.id=@id", JoinType.INNER).SelectToPageDynamic("s.*", "l.id", 1, 10, new { id = 1 }); //--------拼接-----//
Sqlable sable = db.Sqlable().From<Student>("s").Join<School>("l", "s.sch_id", "l.id", JoinType.INNER);
string name = "a";
int id = 1;
if (!string.IsNullOrEmpty(name))
{
sable = sable.Where("s.name=@name");
}
if (!string.IsNullOrEmpty(name))
{
sable = sable.Where("s.id=@id or s.id=100");
}
if (id > 0)
{
sable = sable.Where("l.id in (select top 10 id from school)");//where加子查询
}
var pars = new { id = id, name = name };
int pageCount = sable.Count(pars);
var list7 = sable.SelectToPageList<Student>("s.*", "l.id desc", 1, 20, pars); }
} /// <summary>
/// 单表查询
/// </summary>
private void QueryableDemo()
{ using (var db = SugarDao.GetInstance())
{ //---------Queryable<T>,扩展函数查询---------// //针对单表或者视图查询 //查询所有
var student = db.Queryable<Student>().ToList();
var studentDynamic = db.Queryable<Student>().ToDynamic();
var studentJson = db.Queryable<Student>().ToJson(); //查询单条
var single = db.Queryable<Student>().Single(c => c.id == 1);
//查询单条没有记录返回空对象
var single2 = db.Queryable<Student>().Where(c => c.id == 1).SingleOrDefault(); //查询第一条
var first = db.Queryable<Student>().Where(c => c.id == 1).First();
var first2 = db.Queryable<Student>().Where(c => c.id == 1).FirstOrDefault(); //取10-20条
var page1 = db.Queryable<Student>().Where(c => c.id > 10).OrderBy("id").Skip(10).Take(20).ToList(); //上一句的简化写法,同样取10-20条
var page2 = db.Queryable<Student>().Where(c => c.id > 10).OrderBy("id").ToPageList(2, 10); //查询条数
var count = db.Queryable<Student>().Where(c => c.id > 10).Count(); //从第2条开始以后取所有
var skip = db.Queryable<Student>().Where(c => c.id > 10).OrderBy("id").Skip(2).ToList(); //取前2条
var take = db.Queryable<Student>().Where(c => c.id > 10).OrderBy("id").Take(2).ToList(); // Not like
string conval = "a";
var notLike = db.Queryable<Student>().Where(c => !c.name.Contains(conval.ToString())).ToList();
//Like
conval = "三";
var like = db.Queryable<Student>().Where(c => c.name.Contains(conval)).ToList(); // 可以在拉姆达使用 ToString和 Convert,比EF出色的地方
var convert1 = db.Queryable<Student>().Where(c => c.name == "a".ToString()).ToList();
var convert2 = db.Queryable<Student>().Where(c => c.id == Convert.ToInt32("1")).ToList();//
var convert3 = db.Queryable<Student>().Where(c => DateTime.Now > Convert.ToDateTime("2015-1-1")).ToList();
var convert4 = db.Queryable<Student>().Where(c => DateTime.Now > DateTime.Now).ToList(); //支持字符串Where 让你解决,更复杂的查询
var student12 = db.Queryable<Student>().Where(c => "a" == "a").Where("id>100").ToList();
var student13 = db.Queryable<Student>().Where(c => "a" == "a").Where("id>100 and id in( select 1)").ToList(); //存在记录反回true,则否返回false
bool isAny100 = db.Queryable<Student>().Any(c => c.id == 100);
bool isAny1 = db.Queryable<Student>().Any(c => c.id == 1); int maxId = db.Queryable<Student>().Max<Student, int>("id");
int minId = db.Queryable<Student>().Where(c => c.id > 0).Min<Student, int>("id"); //In
var list1 = db.Queryable<Student>().In("id", "1", "2", "3").ToList();
var list2 = db.Queryable<Student>().In("id", new string[] { "1", "2", "3" }).ToList();
var list3 = db.Queryable<Student>().In("id", new List<string> { "1", "2", "3" }).ToList();
var list4 = db.Queryable<Student>().Where(it => it.id < 10).In("id", new List<string> { "1", "2", "3" }).ToList(); //分组查询
var list5 = db.Queryable<Student>().Where(c => c.id < 20).GroupBy("sex").Select<Student, SexTotal>("Sex,Count=count(*)").ToList();
//SELECT Sex,Count=count(*) FROM Student WHERE 1=1 AND (id < 20) GROUP BY Sex --生成结果 }
}
}
}

更多用法:

http://www.cnblogs.com/sunkaixuan/p/5654695.html  除了并行计算的功能其它都移植成功

源代码:

Core版本

https://github.com/sunkaixuan/ASP_NET_CORE_ORM_SqlSugar

.net 版本

https://github.com/sunkaixuan/SqlSugar

Asp.net Core的代码移植技巧,半天将SqlSugarORM转成Core的更多相关文章

  1. ASP.NET 性能监控工具和优化技巧

    转载自:http://blog.haoitsoft.com/index.php/archives/657 ASP.NET 性能监控工具和优化技巧 发表回复 为了阐明准确甄别性能问题的重要性,下面列举了 ...

  2. 谈谈选用技术的原则,技术学习方法技巧,阅读代码的技巧及其它 MSF的一点心得

    谈谈技术原则,技术学习方法,代码阅读及其它(正文) 这篇文章是前一阵在水木BBS上和别人讨论中偶自己发言的摘编,是偶这几年开发过程完全经验式的总结.完全个人经验,供批判. 一.选用技术的原则 比较规范 ...

  3. NET Core的代码安全分析工具 - Security Code Scan

    NET Core的代码安全分析工具 - Security Code Scan https://www.cnblogs.com/edisonchou/p/edc_security_code_scan_s ...

  4. 将Linux代码移植到Windows的简单方法

    一.前言 Linux拥有丰富各种源代码资源,但是大部分代码在Windows平台情况是无法正常编译的.Windows平台根本无法直接利用这些源代码资源.如果想要使用完整的代码,就要做移植工作.因为C/C ...

  5. ASP.NET Core搭建多层网站架构【9.2-使用Castle.Core实现动态代理拦截器】

    2020/01/31, ASP.NET Core 3.1, VS2019, Autofac.Extras.DynamicProxy 4.5.0, Castle.Core.AsyncIntercepto ...

  6. CUDA代码移植

    如果CUDA的代码移植,一个是要 include文件夹对不对,这个是.h文件能否找到的关键,另一个就是lib,这个是.lib文件能否找到的关键.具体检查地方,见下头. include: lib:

  7. ASP.NET中使用代码来进行备份和还原数据库

    ASP.NET中使用代码来进行备份和还原数据库  SQL代码: 1 2 3 4 5 -- 备份数据库 backup database db_CSManage to disk='c:\backup.ba ...

  8. Asp.Net MVC 页面代码压缩筛选器-自定义删除无效内容

    Asp.Net MVC 页面代码压缩筛选器 首先定义以下筛选器,用于代码压缩. /*页面压缩 筛选器*/ public class WhiteSpaceFilter : Stream { privat ...

  9. IIS ASP.NET 版本转换批处理代码

    原文 IIS ASP.NET 版本转换批处理代码 用来转换asp.net版本的代码,需要的朋友可以参考下. 标识符的查看方法:iisaspnet.bat代码 复制代码代码如下: @echo off e ...

随机推荐

  1. GnuPG 1.4.15 发布,邮件加密工具

    GnuPG 1.4.15 改进包括: * Fixed possible infinite recursion in the compressed packet parser. [CVE-2013-44 ...

  2. cefsharp开发实例1

    做了几年.NET开发,基本都是搞WEB居多,以前也搞过一个winform项目,虽然很把界面拼接出来了,但是感觉有点痛苦,改动的时候又要改动一大堆代码.最近又要搞个桌面软件,试着搜索了下html做界面方 ...

  3. Blend 2015 教程 (二) 样式

    前一篇讲述了如何在新Blend中完成一个简单的带数据绑定的界面小例子,本篇将讲述一下,把View层和Style层分开,并搭建Style层框架的方法,并进行细节样式修改. 1. 在解决方案资源管理器面板 ...

  4. 如何捕获和分析 JavaScript Error

    前端工程师都知道 JavaScript 有基本的异常处理能力.我们可以 throw new Error(),浏览器也会在我们调用 API 出错时抛出异常.但估计绝大多数前端工程师都没考虑过收集这些异常 ...

  5. c++实现冒泡排序

    # include<iostream> #include<stdio.h> using namespace std; void maopao(int *list){ int i ...

  6. 我的第一个Linux C 程序

    说明:上篇博客把gcc安装了,接着我们就尝试一下她的厉害吧. 我用的是vi的超级版本vim.这条指令,也就是用vim打开这个文件,如果文件不存在的话,那么创建这个文件. 关于Linux文件的创建,也可 ...

  7. MyBatis入门学习(一)

    一.MyBatis入门简要介绍(百科) MyBatis 是支持普通 SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis 消除了几乎所有的JDBC代码和参数的手工设置以及结果集的检索.MyB ...

  8. 转 jsp中 session的简单用法

    Session对象:是用来分别保存每一个用户信息的对象,以便于跟踪用户的操作状态.Session的信息保存在服务端,Session的ID保存在客户机的Cookie中.事实上,在许多服务器上,如果浏览器 ...

  9. python 多线程网络编程 ( 二 )

    背景 我在[第一篇文章中]已经介绍了如何实现一个多线程的todo应用,接下来我将会研究如何使这个服务器完成下面这几个功能. 1.使用正则表达式解析用户发送的请求数据: 2.使用ThreadLocal技 ...

  10. iOS---类方法(静态方法)和实例方法

    类方法   实例方法是以+开头的方法, 实例方法是用实例对象访问:   类方法的对象是类而不是实例,通常用来创建对象或者工具类.     在实例方法里,根据继承原理发送消息给self和super其实都 ...