protected override void BuildCommand() { base.dbCommand.CommandText = this.spName; base.dbCommand.CommandType = CommandType.StoredProcedure; SPSchema schema = CacheManager.Instance.GetEntity <SPSchema, string>(owner.ConnectionName, spName, TimeSpan.MaxValue, (name) => { return(owner.DbDriver.GetSpSchema(name)); }); ThrowExceptionUtil.ArgumentConditionTrue(schema != null, "tableName", "Can not find sp. Name:{0}".FormatWith(spName)); DataAdapterParser dataAdapterParser = new DataAdapterParser(owner, dataAdapter); if (dataAdapter != null) { foreach (SPParameter spParameter in schema.ParameterList) { DbParameter parameter = owner.DbDriver.CreateParameter(); parameter.ParameterName = spParameter.Name; parameter.Direction = spParameter.Direction; //parameter.DbType = spParameter.DbType; if (spParameter.DbType == "REF CURSOR") { IEntityProxy parameterProxy = EntityProxyManager.Instance.GetEntityProxyFromType(parameter.GetType()); if (parameter.GetType().Namespace == "System.Data.OracleClient") { parameterProxy.SetPropertyValue(parameter, "OracleType", 5); //parameter.DbType = (DbType)5; } else { parameterProxy.SetPropertyValue(parameter, "OracleDbType", 0x79); } } if (dataAdapter[spParameter.Name] != null) { parameter.Value = dataAdapter[spParameter.Name]; } else { if (owner.DbDriver.DbTypeMap.ContainsKey(spParameter.DbType)) { Type type = owner.DbDriver.DbTypeMap[spParameter.DbType]; parameter.Value = GetDefaultValue(type); if (spParameter.Direction == ParameterDirection.InputOutput && spParameter.MaxLength > 0) { parameter.Size = spParameter.MaxLength * 2; } } } base.dbCommand.Parameters.Add(parameter); } } }
public override bool Equals(object obj) { bool result = false; SPSchema schema = obj as SPSchema; if ((schema != null) && (string.Compare(this.spName, schema.spName, true) == 0)) { result = true; } return(result); }