Skip to content

Commit

Permalink
Allow using IUnitOfWork as parameter (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarendorff2 authored May 7, 2024
1 parent 1ce74f0 commit 46e8191
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq.Expressions;
using System.Reflection;
using Fluss.UnitOfWork;
using HotChocolate.Internal;
using HotChocolate.Resolvers;

Expand Down Expand Up @@ -36,7 +37,8 @@ public class UnitOfWorkParameterExpressionBuilder : IParameterExpressionBuilder
typeof(IHasContextData).GetProperty(
nameof(IHasContextData.ContextData))!;

public bool CanHandle(ParameterInfo parameter) => typeof(UnitOfWork.UnitOfWork) == parameter.ParameterType;
public bool CanHandle(ParameterInfo parameter) => typeof(UnitOfWork.UnitOfWork) == parameter.ParameterType
|| typeof(IUnitOfWork) == parameter.ParameterType;

/*
* Produces something like this: context.GetOrSetGlobalState(
Expand Down

0 comments on commit 46e8191

Please sign in to comment.