|
6 | 6 |
|
7 | 7 | namespace ConnectionFactory |
8 | 8 | { |
| 9 | +<<<<<<< HEAD |
9 | 10 | public partial class CfCommand |
| 11 | +======= |
| 12 | + public partial class CfCommand : IDisposable |
| 13 | +>>>>>>> ba793c7ae09df0e7280087f86968eb9435428a79 |
10 | 14 | { |
11 | 15 | #region ExecuteReader |
12 | 16 |
|
@@ -38,8 +42,52 @@ public IDataReader ExecuteReader(CfCommandType cmdType, string cmdText, IEnumera |
38 | 42 |
|
39 | 43 | public IDataReader ExecuteReader(CfCommandType cmdType, string cmdText, object cmdParms) |
40 | 44 | { |
| 45 | +<<<<<<< HEAD |
41 | 46 | var cfParams = ConvertObjectToCfParameters(cmdParms); |
42 | 47 | return ExecuteReader(cmdType, cmdText, cfParams); |
| 48 | +======= |
| 49 | + try |
| 50 | + { |
| 51 | + IList<CfParameter> cfParams = null; |
| 52 | + if (cmdParms != null) |
| 53 | + { |
| 54 | + if (!(cmdParms is IEnumerable<CfParameter>)) |
| 55 | + { |
| 56 | + |
| 57 | + var props = cmdParms as ExpandoObject as IDictionary<string, object>; |
| 58 | + if (props != null) |
| 59 | + { |
| 60 | + cfParams = new List<CfParameter>(props.Count()); |
| 61 | + foreach (var p in props) |
| 62 | + { |
| 63 | + cfParams.Add(new CfParameter(p.Key, p.Value)); |
| 64 | + } |
| 65 | + } |
| 66 | + else |
| 67 | + { |
| 68 | + var properties = cmdParms.GetType().GetProperties(); |
| 69 | + if (properties.Any()) |
| 70 | + { |
| 71 | + cfParams = new List<CfParameter>(properties.Count()); |
| 72 | + foreach (var property in properties) |
| 73 | + { |
| 74 | + cfParams.Add(new CfParameter(property.Name, property.GetValue(cmdParms, null))); |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + _conn.EstablishFactoryConnection(); |
| 82 | + PrepareCommand(cmdType, cmdText, cfParams); |
| 83 | + return _cmd.ExecuteReader(CommandBehavior.CloseConnection); |
| 84 | + } |
| 85 | + catch (Exception ex) |
| 86 | + { |
| 87 | + Logger.Error(ex); |
| 88 | + throw new CfException("Unknown Error (Connection Factory: ExecuteReader) " + ex.Message, ex); |
| 89 | + } |
| 90 | +>>>>>>> ba793c7ae09df0e7280087f86968eb9435428a79 |
43 | 91 | } |
44 | 92 |
|
45 | 93 | #endregion |
|
0 commit comments