-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: A lot of test cases added and bugfixes made * feat: Handling exception when trigger builder uses an entity not added in a DbContext * feat: Support of Math, String functions added Co-authored-by: Ilya Belyanskiy <win7user20@gmail.com>
- Loading branch information
Showing
112 changed files
with
2,860 additions
and
934 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 9 additions & 8 deletions
17
...Call/Math/AtanTwo/MathAtanTwoConverter.cs → ...thodCall/Math/Atan2/BaseAtan2Converter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
using Laraue.EfCoreTriggers.Common.SqlGeneration; | ||
using Laraue.EfCoreTriggers.Common.TriggerBuilders; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
using Laraue.EfCoreTriggers.Common.Extensions; | ||
using Laraue.EfCoreTriggers.Common.SqlGeneration; | ||
using Laraue.EfCoreTriggers.Common.TriggerBuilders; | ||
|
||
namespace Laraue.EfCoreTriggers.Common.Converters.MethodCall.Math.AtanTwo | ||
namespace Laraue.EfCoreTriggers.Common.Converters.MethodCall.Math.Atan2 | ||
{ | ||
public class MathAtanTwoConverter : BaseMathConverter | ||
public abstract class BaseAtan2Converter : BaseMathConverter | ||
{ | ||
public override string MethodName => nameof(System.Math.Atan2); | ||
|
||
protected abstract string SqlFunctionName { get; } | ||
|
||
public override SqlBuilder BuildSql(BaseExpressionProvider provider, MethodCallExpression expression, Dictionary<string, ArgumentType> argumentTypes) | ||
{ | ||
var argumentsSql = provider.GetMethodCallArgumentsSql(expression, argumentTypes); | ||
|
||
return new SqlBuilder($"ATAN2({argumentsSql[0]}, {argumentsSql[1]})") | ||
return new SqlBuilder($"{SqlFunctionName}({argumentsSql[0]}, {argumentsSql[1]})") | ||
.MergeColumnsInfo(argumentsSql); | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Laraue.EfCoreTriggers.Common/Converters/MethodCall/Math/Atan2/MathAtan2Converter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Laraue.EfCoreTriggers.Common.Converters.MethodCall.Math.Atan2 | ||
{ | ||
public class MathAtan2Converter : BaseAtan2Converter | ||
{ | ||
protected override string SqlFunctionName => "ATAN2"; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Laraue.EfCoreTriggers.Common/Converters/MethodCall/Math/Atan2/MathAtn2Converter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Laraue.EfCoreTriggers.Common.Converters.MethodCall.Math.Atan2 | ||
{ | ||
public class MathAtn2Converter : BaseAtan2Converter | ||
{ | ||
protected override string SqlFunctionName => "ATN2"; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Laraue.EfCoreTriggers.Common/Converters/MethodCall/Math/Ceiling/MathCeilConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Laraue.EfCoreTriggers.Common.SqlGeneration; | ||
using Laraue.EfCoreTriggers.Common.TriggerBuilders; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
|
||
namespace Laraue.EfCoreTriggers.Common.Converters.MethodCall.Math.Ceiling | ||
{ | ||
public class MathCeilConverter : BaseMathConverter | ||
{ | ||
public override string MethodName => nameof(System.Math.Ceiling); | ||
|
||
public override SqlBuilder BuildSql(BaseExpressionProvider provider, MethodCallExpression expression, Dictionary<string, ArgumentType> argumentTypes) | ||
{ | ||
var argument = expression.Arguments[0]; | ||
var sqlBuilder = provider.GetExpressionSql(argument, argumentTypes); | ||
return new SqlBuilder(sqlBuilder.AffectedColumns, $"CEIL({sqlBuilder})"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...Triggers.Common/Converters/MethodCall/String/Trim/StringTrimViaLtrimRtrimFuncConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Laraue.EfCoreTriggers.Common.Converters.MethodCall.String.Trim | ||
{ | ||
public class StringTrimViaLtrimRtrimFuncConverter : BaseStringTrimConverter | ||
{ | ||
protected override string[] SqlTrimFunctionsNamesToApply { get; } = { "LTRIM", "RTRIM" }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.