ServiceContext
Represents the context of a service.
using Stashbox.Registration;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
namespace Stashbox.Resolution
{
[NullableContext(1)]
[Nullable(0)]
public readonly struct ServiceContext
{
public readonly Expression ServiceExpression;
[Nullable(2)]
public readonly ServiceRegistration ServiceRegistration;
internal static readonly ServiceContext Empty;
public ServiceContext(Expression serviceExpression, [Nullable(2)] ServiceRegistration serviceRegistration)
{
ServiceExpression = serviceExpression;
ServiceRegistration = serviceRegistration;
}
internal bool IsEmpty()
{
return Equals(Empty);
}
private bool Equals(ServiceContext other)
{
if (ServiceExpression == other.ServiceExpression)
return ServiceRegistration == other.ServiceRegistration;
return false;
}
}
}