/// <summary> /// 创建StoreProcedure对象的实例 /// </summary> /// <param name="spName">存储过程名称</param> /// <param name="parameters">匿名对象</param> /// <returns>StoreProcedure对象实例</returns> public static StoreProcedure Create(string spName, DbParameter[] parameters) { StoreProcedure sp = new StoreProcedure(ConnectionScope.GetDefaultDbConext()); sp.Init(spName, parameters); return(sp); }
/// <summary> /// 创建StoreProcedure对象的实例 /// </summary> /// <param name="spName">存储过程名称</param> /// <param name="argsObject">匿名对象参数</param> /// <returns>StoreProcedure对象实例</returns> public static StoreProcedure Create(string spName, object argsObject) { StoreProcedure sp = new StoreProcedure(ConnectionScope.GetDefaultDbConext()); sp.Init(spName, argsObject); return(sp); }
/// <summary> /// 创建一个XmlCommand对象实例。 /// </summary> /// <param name="name">命令名字</param> /// <param name="argsObject">匿名对象表示的参数</param> /// <returns></returns> public static XmlCommand Create(string name, object argsObject) { XmlCommand command = new XmlCommand(ConnectionScope.GetDefaultDbConext()); command.Init(name, argsObject); return(command); }
/// <summary> /// 根据指定的参数化SQL语句,创建CPQuery对象实例 /// </summary> /// <param name="parameterizedSQL">参数化SQL语句</param> /// <returns>CPQuery对象实例</returns> public static CPQuery Create(string parameterizedSQL = null) { //if( string.IsNullOrEmpty(parameterizedSQL) ) // throw new ArgumentNullException("parameterizedSQL"); CPQuery query = new CPQuery(ConnectionScope.GetDefaultDbConext()); query.Init(parameterizedSQL); return(query); }
/// <summary> /// 创建一个XmlCommand对象实例。 /// </summary> /// <param name="name">命令名字</param> /// <param name="dictionary">要传递的参数字典</param> /// <returns></returns> public static XmlCommand Create(string name, Dictionary <string, object> dictionary) { // 说明:保留这个重载,而不是用匿名对象来代替是因为: // 匿名对象是只读的,需要一次性构造,而Dictionary可以在不同的代码段中分开构造。 // 所以,不要删除这个重载方法。 XmlCommand command = new XmlCommand(ConnectionScope.GetDefaultDbConext()); command.Init(name, dictionary); return(command); }
/// <summary> /// 通过参数化SQL、哈希表的方式,创建CPQuery对象实例 /// </summary> /// <param name="parameterizedSQL">参数化的SQL字符串</param> /// <param name="dictionary">哈希表</param> /// <returns>CPQuery对象实例</returns> public static CPQuery Create(string parameterizedSQL, Dictionary <string, object> dictionary) { if (string.IsNullOrEmpty(parameterizedSQL)) { throw new ArgumentNullException("parameterizedSQL"); } CPQuery query = new CPQuery(ConnectionScope.GetDefaultDbConext()); query.Init(parameterizedSQL, dictionary); return(query); }