Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="4.1.0-preview-680" />

 ExpressionLifetimeDescriptor

Represents a lifetime descriptor which applies to 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(ServiceRegistration serviceRegistration, ResolutionContext resolutionContext, Type requestedType) { Expression expressionForRegistration = LifetimeDescriptor.GetExpressionForRegistration(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); } }