Added ability to set nolock with db.From<Table>(alias, nolock);

This commit is contained in:
2024-05-24 09:07:51 +02:00
parent 437403f966
commit a7bc6b9949
3 changed files with 73 additions and 0 deletions

View File

@@ -381,6 +381,31 @@ namespace DynamORM
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).As(alias));
}
/// <summary>Adds to the <code>FROM</code> clause using <see cref="Type"/>.</summary>
/// <typeparam name="T">Type which can be represented in database.</typeparam>
/// <param name="noLock">use no lock.</param>
/// <returns>This instance to permit chaining.</returns>
public virtual IDynamicSelectQueryBuilder From<T>(bool noLock)
{
if (noLock)
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).NoLock());
else
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)));
}
/// <summary>Adds to the <code>FROM</code> clause using <see cref="Type"/>.</summary>
/// <typeparam name="T">Type which can be represented in database.</typeparam>
/// <param name="alias">Table alias.</param>
/// <param name="noLock">use no lock.</param>
/// <returns>This instance to permit chaining.</returns>
public virtual IDynamicSelectQueryBuilder From<T>(string alias, bool noLock)
{
if (noLock)
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).As(alias).NoLock());
else
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).As(alias));
}
/// <summary>Adds to the <code>FROM</code> clause using <see cref="Type"/>.</summary>
/// <param name="t">Type which can be represented in database.</param>
/// <returns>This instance to permit chaining.</returns>