Skip to content

Commit

Permalink
Merge branch 'master' into feature/ISS-44-support-of-string-enum-values
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Laraue.EfCoreTriggers.Common/Laraue.EfCoreTriggers.Common.csproj
  • Loading branch information
Ilya Belyanskiy committed Oct 29, 2022
2 parents 48ab9f2 + 59380f0 commit 9a3c02d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static IServiceCollection AddDefaultServices(this IServiceCollection serv

.AddMethodCallConverter<CountVisitor>()

.AddSingleton<VisitingInfo>()
.AddScoped<VisitingInfo>()

.AddScoped<IUpdateExpressionVisitor, UpdateExpressionVisitor>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ namespace Laraue.EfCoreTriggers.Common.Services.Impl.ExpressionVisitors;
public class ExpressionVisitorFactory : IExpressionVisitorFactory
{
private readonly IServiceProvider _provider;
private readonly VisitingInfo _visitingInfo;

/// <summary>
/// Initializes a new instance of <see cref="ExpressionVisitorFactory"/>.
/// </summary>
/// <param name="provider"></param>
public ExpressionVisitorFactory(IServiceProvider provider)
/// <param name="visitingInfo"></param>
public ExpressionVisitorFactory(IServiceProvider provider, VisitingInfo visitingInfo)
{
_provider = provider;
_visitingInfo = visitingInfo;
}

/// <inheritdoc />
Expand All @@ -38,9 +41,7 @@ public SqlBuilder Visit(Expression expression, ArgumentTypes argumentTypes, Visi

private SqlBuilder VisitAndRememberMember(MemberExpression expression, ArgumentTypes argumentTypes, VisitedMembers visitedMembers)
{
var info = _provider.GetRequiredService<VisitingInfo>();

return info.ExecuteWithChangingMember(
return _visitingInfo.ExecuteWithChangingMember(
expression.Member,
() => Visit(expression, argumentTypes, visitedMembers));
}
Expand Down
1 change: 1 addition & 0 deletions tests/Laraue.EfCoreTriggers.Tests/Entities/TestEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class TestEntity
public bool BooleanValue { get; set; }

public char CharValue { get; set; }

public UserRole EnumValue { get; set; }
}
}

0 comments on commit 9a3c02d

Please sign in to comment.