Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="3.5.1-preview-625" />

 ExpressionLifetimeDescriptor

Represents a lifetime descriptor which applies to expressions.
using Stashbox.Expressions; using Stashbox.Registration; using Stashbox.Resolution; using System; using System.Linq.Expressions; namespace Stashbox.Lifetime { public abstract class ExpressionLifetimeDescriptor : LifetimeDescriptor { private protected override Expression BuildLifetimeAppliedExpression(ExpressionBuilder expressionBuilder, ServiceRegistration serviceRegistration, ResolutionContext resolutionContext, Type requestedType) { Expression expressionForRegistration = LifetimeDescriptor.GetExpressionForRegistration(expressionBuilder, serviceRegistration, resolutionContext, requestedType); if (expressionForRegistration != null) return ApplyLifetime(expressionForRegistration, serviceRegistration, resolutionContext, requestedType); return null; } protected abstract Expression ApplyLifetime(Expression expression, ServiceRegistration serviceRegistration, ResolutionContext resolutionContext, Type resolveType); } }