chore(sonar)!: clear all 17 remaining src/ code smells #16
@@ -185,33 +185,13 @@ public class LinqQueryBreakdown : QueryBreakdown
|
|||||||
/// Gets a LINQ to SQL query of the specified type based on this breakdown.
|
/// Gets a LINQ to SQL query of the specified type based on this breakdown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The entity type for the query.</typeparam>
|
/// <typeparam name="T">The entity type for the query.</typeparam>
|
||||||
/// <returns>An IQueryable of the specified type reconstructed from the breakdown; an empty queryable if the type doesn't match the original entity type or the original data source isn't available.</returns>
|
/// <returns>An empty queryable. Breakdown analysis is one-way; reconstruction requires the original provider, which is not preserved.</returns>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method attempts to reconstruct a LINQ query from the analyzed components (WHERE, ORDER BY, etc.).
|
/// Always returns an empty queryable today. A future version may reconstruct the LINQ query from
|
||||||
/// If a data source (IQueryable) is available in the breakdown's OriginalExpression, it will be used.
|
/// <see cref="OriginalExpression"/> when the provider is available; until then callers receive an
|
||||||
/// Otherwise, returns an empty queryable — breakdown analysis is one-way; reconstruction requires the original provider.
|
/// empty result rather than a null reference.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public override IQueryable<T> GetQuery<T>() where T : class
|
public override IQueryable<T> GetQuery<T>() where T : class => GetEmptyQueryable<T>();
|
||||||
{
|
|
||||||
if (OriginalExpression == null)
|
|
||||||
{
|
|
||||||
return GetEmptyQueryable<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (OriginalExpression is Expression && EntityType == typeof(T))
|
|
||||||
{
|
|
||||||
return GetEmptyQueryable<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetEmptyQueryable<T>();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return GetEmptyQueryable<T>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get and empty queryable of T
|
/// Get and empty queryable of T
|
||||||
|
|||||||
@@ -100,10 +100,7 @@ public class QueryBreakdown : SqlServerQueryBreakdown
|
|||||||
base.AddParameter(colonName.TrimStart(':', '@'), value);
|
base.AddParameter(colonName.TrimStart(':', '@'), value);
|
||||||
|
|
||||||
// Add both formats to dictionary for compatibility
|
// Add both formats to dictionary for compatibility
|
||||||
if (Parameters.ContainsKey($"@{colonName.TrimStart(':', '@')}"))
|
|
||||||
{
|
|
||||||
Parameters.Remove($"@{colonName.TrimStart(':', '@')}");
|
Parameters.Remove($"@{colonName.TrimStart(':', '@')}");
|
||||||
}
|
|
||||||
Parameters[colonName] = value;
|
Parameters[colonName] = value;
|
||||||
Parameters[atName] = value;
|
Parameters[atName] = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class SqlParseException : Exception
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.AppendLine($"SQL (truncated): {sql.Substring(0, 197)}...");
|
sb.AppendLine($"SQL (truncated): {sql.AsSpan(0, 197)}...");
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
|
|||||||
Reference in New Issue
Block a user