This commit is contained in:
@@ -2916,7 +2916,7 @@ namespace DynamORM
|
|||||||
/// <param name="cmd">Command containing query to execute.</param>
|
/// <param name="cmd">Command containing query to execute.</param>
|
||||||
/// <returns>List of <see cref="DynamicSchemaColumn"/> objects .
|
/// <returns>List of <see cref="DynamicSchemaColumn"/> objects .
|
||||||
/// If your database doesn't get those values in upper case (like most of the databases) you should override this method.</returns>
|
/// If your database doesn't get those values in upper case (like most of the databases) you should override this method.</returns>
|
||||||
protected virtual IEnumerable<DynamicSchemaColumn> ReadSchema(IDbCommand cmd)
|
public virtual IEnumerable<DynamicSchemaColumn> ReadSchema(IDbCommand cmd)
|
||||||
{
|
{
|
||||||
DataTable st = null;
|
DataTable st = null;
|
||||||
|
|
||||||
@@ -5399,12 +5399,12 @@ namespace DynamORM
|
|||||||
cmd.AddParameter(
|
cmd.AddParameter(
|
||||||
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
||||||
ds.Type, ds.Size, ds.Precision, ds.Scale,
|
ds.Type, ds.Size, ds.Precision, ds.Scale,
|
||||||
isOut ? DBNull.Value : arg);
|
isOut ? DBNull.Value : dcv.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cmd.AddParameter(
|
cmd.AddParameter(
|
||||||
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
||||||
arg == null ? DbType.String : arg.GetType().ToDbType(), 0, isOut ? DBNull.Value : arg);
|
arg == null ? DbType.String : arg.GetType().ToDbType(), 0, isOut ? DBNull.Value : dcv.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -252,9 +252,9 @@ namespace DynamORM
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Properties and Constructors
|
#endregion Properties and Constructors
|
||||||
|
|
||||||
#region Table
|
#region Table
|
||||||
|
|
||||||
#if !DYNAMORM_OMMIT_OLDSYNTAX
|
#if !DYNAMORM_OMMIT_OLDSYNTAX
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ namespace DynamORM
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endregion Table
|
#endregion Table
|
||||||
|
|
||||||
/// <summary>Adds cached builder.</summary>
|
/// <summary>Adds cached builder.</summary>
|
||||||
/// <param name="builder">New dynamic builder.</param>
|
/// <param name="builder">New dynamic builder.</param>
|
||||||
@@ -347,7 +347,7 @@ namespace DynamORM
|
|||||||
RemainingBuilders.Remove(builder);
|
RemainingBuilders.Remove(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region From/Insert/Update/Delete
|
#region From/Insert/Update/Delete
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds to the <code>FROM</code> clause the contents obtained by parsing the dynamic lambda expressions given. The supported
|
/// Adds to the <code>FROM</code> clause the contents obtained by parsing the dynamic lambda expressions given. The supported
|
||||||
@@ -630,7 +630,7 @@ namespace DynamORM
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#region Update
|
#region Update
|
||||||
|
|
||||||
Dictionary<IDbDataParameter, DynamicPropertyInvoker> parametersUp = new Dictionary<IDbDataParameter, DynamicPropertyInvoker>();
|
Dictionary<IDbDataParameter, DynamicPropertyInvoker> parametersUp = new Dictionary<IDbDataParameter, DynamicPropertyInvoker>();
|
||||||
|
|
||||||
@@ -653,9 +653,9 @@ namespace DynamORM
|
|||||||
else
|
else
|
||||||
PrepareBatchUpdate(t, mapper, cmdUp, parametersUp);
|
PrepareBatchUpdate(t, mapper, cmdUp, parametersUp);
|
||||||
|
|
||||||
#endregion Update
|
#endregion Update
|
||||||
|
|
||||||
#region Insert
|
#region Insert
|
||||||
|
|
||||||
Dictionary<IDbDataParameter, DynamicPropertyInvoker> parametersIn = new Dictionary<IDbDataParameter, DynamicPropertyInvoker>();
|
Dictionary<IDbDataParameter, DynamicPropertyInvoker> parametersIn = new Dictionary<IDbDataParameter, DynamicPropertyInvoker>();
|
||||||
|
|
||||||
@@ -678,7 +678,7 @@ namespace DynamORM
|
|||||||
else
|
else
|
||||||
PrepareBatchInsert(t, mapper, cmdIn, parametersIn);
|
PrepareBatchInsert(t, mapper, cmdIn, parametersIn);
|
||||||
|
|
||||||
#endregion Insert
|
#endregion Insert
|
||||||
|
|
||||||
foreach (var o in e)
|
foreach (var o in e)
|
||||||
{
|
{
|
||||||
@@ -1023,9 +1023,9 @@ namespace DynamORM
|
|||||||
mapper.DeleteCommandText = cmd.CommandText;
|
mapper.DeleteCommandText = cmd.CommandText;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion From/Insert/Update/Delete
|
#endregion From/Insert/Update/Delete
|
||||||
|
|
||||||
#region Procedure
|
#region Procedure
|
||||||
|
|
||||||
/// <summary>Execute stored procedure.</summary>
|
/// <summary>Execute stored procedure.</summary>
|
||||||
/// <param name="procName">Name of stored procedure to execute.</param>
|
/// <param name="procName">Name of stored procedure to execute.</param>
|
||||||
@@ -1092,9 +1092,9 @@ namespace DynamORM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Procedure
|
#endregion Procedure
|
||||||
|
|
||||||
#region Execute
|
#region Execute
|
||||||
|
|
||||||
/// <summary>Execute non query.</summary>
|
/// <summary>Execute non query.</summary>
|
||||||
/// <param name="sql">SQL query containing numbered parameters in format provided by
|
/// <param name="sql">SQL query containing numbered parameters in format provided by
|
||||||
@@ -1151,9 +1151,9 @@ namespace DynamORM
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Execute
|
#endregion Execute
|
||||||
|
|
||||||
#region Scalar
|
#region Scalar
|
||||||
|
|
||||||
/// <summary>Returns a single result.</summary>
|
/// <summary>Returns a single result.</summary>
|
||||||
/// <param name="sql">SQL query containing numbered parameters in format provided by
|
/// <param name="sql">SQL query containing numbered parameters in format provided by
|
||||||
@@ -1224,9 +1224,9 @@ namespace DynamORM
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endregion Scalar
|
#endregion Scalar
|
||||||
|
|
||||||
#region Query
|
#region Query
|
||||||
|
|
||||||
/// <summary>Enumerate the reader and yield the result.</summary>
|
/// <summary>Enumerate the reader and yield the result.</summary>
|
||||||
/// <param name="sql">SQL query containing numbered parameters in format provided by
|
/// <param name="sql">SQL query containing numbered parameters in format provided by
|
||||||
@@ -1308,9 +1308,9 @@ namespace DynamORM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Query
|
#endregion Query
|
||||||
|
|
||||||
#region Schema
|
#region Schema
|
||||||
|
|
||||||
/// <summary>Builds query cache if necessary and returns it.</summary>
|
/// <summary>Builds query cache if necessary and returns it.</summary>
|
||||||
/// <param name="builder">The builder containing query to read schema from.</param>
|
/// <param name="builder">The builder containing query to read schema from.</param>
|
||||||
@@ -1453,7 +1453,7 @@ namespace DynamORM
|
|||||||
/// <param name="cmd">Command containing query to execute.</param>
|
/// <param name="cmd">Command containing query to execute.</param>
|
||||||
/// <returns>List of <see cref="DynamicSchemaColumn"/> objects .
|
/// <returns>List of <see cref="DynamicSchemaColumn"/> objects .
|
||||||
/// If your database doesn't get those values in upper case (like most of the databases) you should override this method.</returns>
|
/// If your database doesn't get those values in upper case (like most of the databases) you should override this method.</returns>
|
||||||
protected virtual IEnumerable<DynamicSchemaColumn> ReadSchema(IDbCommand cmd)
|
public virtual IEnumerable<DynamicSchemaColumn> ReadSchema(IDbCommand cmd)
|
||||||
{
|
{
|
||||||
DataTable st = null;
|
DataTable st = null;
|
||||||
|
|
||||||
@@ -1521,7 +1521,7 @@ namespace DynamORM
|
|||||||
(Options & DynamicDatabaseOptions.SupportSchema) == DynamicDatabaseOptions.SupportSchema;
|
(Options & DynamicDatabaseOptions.SupportSchema) == DynamicDatabaseOptions.SupportSchema;
|
||||||
bool mapperSchema = mapper != null && mapper.Table != null && (mapper.Table.Override || !databaseSchemaSupport);
|
bool mapperSchema = mapper != null && mapper.Table != null && (mapper.Table.Override || !databaseSchemaSupport);
|
||||||
|
|
||||||
#region Database schema
|
#region Database schema
|
||||||
|
|
||||||
if (databaseSchemaSupport && !Schema.ContainsKey(tableName.ToLower()))
|
if (databaseSchemaSupport && !Schema.ContainsKey(tableName.ToLower()))
|
||||||
{
|
{
|
||||||
@@ -1533,9 +1533,9 @@ namespace DynamORM
|
|||||||
Schema[tableName.ToLower()] = schema;
|
Schema[tableName.ToLower()] = schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Database schema
|
#endregion Database schema
|
||||||
|
|
||||||
#region Type schema
|
#region Type schema
|
||||||
|
|
||||||
if ((mapperSchema && !Schema.ContainsKey(mapper.Type.FullName)) ||
|
if ((mapperSchema && !Schema.ContainsKey(mapper.Type.FullName)) ||
|
||||||
(schema == null && mapper != null && !mapper.Type.IsAnonymous()))
|
(schema == null && mapper != null && !mapper.Type.IsAnonymous()))
|
||||||
@@ -1543,7 +1543,7 @@ namespace DynamORM
|
|||||||
// TODO: Ged rid of this monster below...
|
// TODO: Ged rid of this monster below...
|
||||||
if (databaseSchemaSupport)
|
if (databaseSchemaSupport)
|
||||||
{
|
{
|
||||||
#region Merge with db schema
|
#region Merge with db schema
|
||||||
|
|
||||||
schema = mapper.ColumnsMap.ToDictionary(k => k.Key, (v) =>
|
schema = mapper.ColumnsMap.ToDictionary(k => k.Key, (v) =>
|
||||||
{
|
{
|
||||||
@@ -1579,11 +1579,11 @@ namespace DynamORM
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
#endregion Merge with db schema
|
#endregion Merge with db schema
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#region MapEnumerable based only on type
|
#region MapEnumerable based only on type
|
||||||
|
|
||||||
schema = mapper.ColumnsMap.ToDictionary(k => k.Key,
|
schema = mapper.ColumnsMap.ToDictionary(k => k.Key,
|
||||||
v => new DynamicSchemaColumn
|
v => new DynamicSchemaColumn
|
||||||
@@ -1598,21 +1598,21 @@ namespace DynamORM
|
|||||||
Scale = DynamicExtensions.CoalesceNullable<byte>(v.Value.Column != null ? v.Value.Column.Scale : null, 0).Value,
|
Scale = DynamicExtensions.CoalesceNullable<byte>(v.Value.Column != null ? v.Value.Column.Scale : null, 0).Value,
|
||||||
});
|
});
|
||||||
|
|
||||||
#endregion MapEnumerable based only on type
|
#endregion MapEnumerable based only on type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapper != null && schema != null)
|
if (mapper != null && schema != null)
|
||||||
Schema[mapper.Type.FullName] = schema;
|
Schema[mapper.Type.FullName] = schema;
|
||||||
|
|
||||||
#endregion Type schema
|
#endregion Type schema
|
||||||
|
|
||||||
return schema;
|
return schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Schema
|
#endregion Schema
|
||||||
|
|
||||||
#region Decorators
|
#region Decorators
|
||||||
|
|
||||||
/// <summary>Gets or sets left side decorator for database objects.</summary>
|
/// <summary>Gets or sets left side decorator for database objects.</summary>
|
||||||
public string LeftDecorator
|
public string LeftDecorator
|
||||||
@@ -1701,9 +1701,9 @@ namespace DynamORM
|
|||||||
cmd.Dump(Console.Out);
|
cmd.Dump(Console.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Decorators
|
#endregion Decorators
|
||||||
|
|
||||||
#region Connection
|
#region Connection
|
||||||
|
|
||||||
/// <summary>Open managed connection.</summary>
|
/// <summary>Open managed connection.</summary>
|
||||||
/// <returns>Opened connection.</returns>
|
/// <returns>Opened connection.</returns>
|
||||||
@@ -1809,9 +1809,9 @@ namespace DynamORM
|
|||||||
.ExecuteNonQuery();
|
.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Connection
|
#endregion Connection
|
||||||
|
|
||||||
#region Transaction
|
#region Transaction
|
||||||
|
|
||||||
/// <summary>Begins a global database transaction.</summary>
|
/// <summary>Begins a global database transaction.</summary>
|
||||||
/// <remarks>Using this method connection is set to single open
|
/// <remarks>Using this method connection is set to single open
|
||||||
@@ -1873,9 +1873,9 @@ namespace DynamORM
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Transaction
|
#endregion Transaction
|
||||||
|
|
||||||
#region IExtendedDisposable Members
|
#region IExtendedDisposable Members
|
||||||
|
|
||||||
/// <summary>Performs application-defined tasks associated with freeing,
|
/// <summary>Performs application-defined tasks associated with freeing,
|
||||||
/// releasing, or resetting unmanaged resources.</summary>
|
/// releasing, or resetting unmanaged resources.</summary>
|
||||||
@@ -1944,6 +1944,6 @@ namespace DynamORM
|
|||||||
/// <summary>Gets a value indicating whether this instance is disposed.</summary>
|
/// <summary>Gets a value indicating whether this instance is disposed.</summary>
|
||||||
public bool IsDisposed { get; private set; }
|
public bool IsDisposed { get; private set; }
|
||||||
|
|
||||||
#endregion IExtendedDisposable Members
|
#endregion IExtendedDisposable Members
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,11 +138,11 @@ namespace DynamORM
|
|||||||
cmd.AddParameter(
|
cmd.AddParameter(
|
||||||
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
||||||
ds.Type, ds.Size, ds.Precision, ds.Scale,
|
ds.Type, ds.Size, ds.Precision, ds.Scale,
|
||||||
isOut ? DBNull.Value : arg);
|
isOut ? DBNull.Value : dcv.Value);
|
||||||
} else
|
} else
|
||||||
cmd.AddParameter(
|
cmd.AddParameter(
|
||||||
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
_db.GetParameterName(paramName), dcv.ParameterDirection,
|
||||||
arg == null ? DbType.String : arg.GetType().ToDbType(), 0, isOut ? DBNull.Value : arg);
|
arg == null ? DbType.String : arg.GetType().ToDbType(), 0, isOut ? DBNull.Value : dcv.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace Tester
|
|||||||
//// "Data Source=test.db3;",
|
//// "Data Source=test.db3;",
|
||||||
//// DynamORM.DynamicDatabaseOptions.SingleConnection | DynamORM.DynamicDatabaseOptions.SingleTransaction |
|
//// DynamORM.DynamicDatabaseOptions.SingleConnection | DynamORM.DynamicDatabaseOptions.SingleTransaction |
|
||||||
//// DynamORM.DynamicDatabaseOptions.SupportSchema | DynamORM.DynamicDatabaseOptions.SupportLimitOffset);
|
//// DynamORM.DynamicDatabaseOptions.SupportSchema | DynamORM.DynamicDatabaseOptions.SupportLimitOffset);
|
||||||
|
///
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
|
|||||||
Reference in New Issue
Block a user