chore(sonar)!: production-code cleanup — S1168 GetQuery + CA1822 static methods #15
@@ -1,5 +1,5 @@
|
|||||||
using System.Linq.Expressions;
|
|
||||||
using Strata.SqlTools.Breakdowns.SqlServer;
|
using Strata.SqlTools.Breakdowns.SqlServer;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using PostgreSqlBreakdown = Strata.SqlTools.Breakdowns.PostgreSql.QueryBreakdown;
|
using PostgreSqlBreakdown = Strata.SqlTools.Breakdowns.PostgreSql.QueryBreakdown;
|
||||||
using SnowflakeBreakdown = Strata.SqlTools.Breakdowns.Snowflake.QueryBreakdown;
|
using SnowflakeBreakdown = Strata.SqlTools.Breakdowns.Snowflake.QueryBreakdown;
|
||||||
|
|
||||||
@@ -195,24 +195,32 @@ public class LinqQueryBreakdown : QueryBreakdown
|
|||||||
{
|
{
|
||||||
if (OriginalExpression == null)
|
if (OriginalExpression == null)
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<T>().AsQueryable();
|
return GetEmptyQueryable<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (OriginalExpression is Expression && EntityType == typeof(T))
|
if (OriginalExpression is Expression && EntityType == typeof(T))
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<T>().AsQueryable();
|
return GetEmptyQueryable<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Enumerable.Empty<T>().AsQueryable();
|
return GetEmptyQueryable<T>();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<T>().AsQueryable();
|
return GetEmptyQueryable<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get and empty queryable of T
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The entity type for the query.</typeparam>
|
||||||
|
/// <returns>An empty IQueryable of the type.</returns>
|
||||||
|
public static IQueryable<T> GetEmptyQueryable<T>() where T : class
|
||||||
|
=> Enumerable.Empty<T>().AsQueryable();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Analyzes an INSERT operation for the given entity.
|
/// Analyzes an INSERT operation for the given entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user