Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="3.2.0-preview-563" />

 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 resolveType) { Expression expressionForRegistration = LifetimeDescriptor.GetExpressionForRegistration(expressionBuilder, serviceRegistration, resolutionContext, resolveType); if (expressionForRegistration != null) return ApplyLifetime(expressionForRegistration, serviceRegistration, resolutionContext, resolveType); return null; } protected abstract Expression ApplyLifetime(Expression expression, ServiceRegistration serviceRegistration, ResolutionContext resolutionContext, Type resolveType); } }