Made single From<T>(...) method. Not preety but more practical
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -448,46 +448,28 @@ namespace DynamORM
|
|||||||
return new DynamicSelectQueryBuilder(this).From(fn);
|
return new DynamicSelectQueryBuilder(this).From(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Adds to the <code>FROM</code> clause using <see cref="Type"/>.</summary>
|
|
||||||
/// <typeparam name="T">Type which can be represented in database.</typeparam>
|
|
||||||
/// <returns>This instance to permit chaining.</returns>
|
|
||||||
public virtual IDynamicSelectQueryBuilder From<T>()
|
|
||||||
{
|
|
||||||
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>
|
|
||||||
/// <returns>This instance to permit chaining.</returns>
|
|
||||||
public virtual IDynamicSelectQueryBuilder From<T>(string alias)
|
|
||||||
{
|
|
||||||
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>
|
/// <summary>Adds to the <code>FROM</code> clause using <see cref="Type"/>.</summary>
|
||||||
/// <typeparam name="T">Type which can be represented in database.</typeparam>
|
/// <typeparam name="T">Type which can be represented in database.</typeparam>
|
||||||
/// <param name="alias">Table alias.</param>
|
/// <param name="alias">Table alias.</param>
|
||||||
/// <param name="noLock">use no lock.</param>
|
/// <param name="noLock">use no lock.</param>
|
||||||
/// <returns>This instance to permit chaining.</returns>
|
/// <returns>This instance to permit chaining.</returns>
|
||||||
public virtual IDynamicSelectQueryBuilder From<T>(string alias, bool noLock)
|
public virtual IDynamicSelectQueryBuilder From<T>(string alias = null, bool noLock = false)
|
||||||
{
|
{
|
||||||
|
// TODO: Make it more readable and maitainable
|
||||||
if (noLock)
|
if (noLock)
|
||||||
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).As(alias).NoLock());
|
{
|
||||||
|
if (string.IsNullOrEmpty(alias))
|
||||||
|
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).NoLock());
|
||||||
|
else
|
||||||
|
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).As(alias).NoLock());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)).As(alias));
|
{
|
||||||
|
if (string.IsNullOrEmpty(alias))
|
||||||
|
return new DynamicSelectQueryBuilder(this).From(x => x(typeof(T)));
|
||||||
|
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>
|
/// <summary>Adds to the <code>FROM</code> clause using <see cref="Type"/>.</summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user