49 lines
1.3 KiB
C#
Executable File
49 lines
1.3 KiB
C#
Executable File
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
|
|
namespace Opsoft.NetCore.O3App.Shared
|
|
{
|
|
//
|
|
// 摘要:
|
|
// An attribute used to define service mapping.
|
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
|
public sealed class MapToAttribute : Attribute
|
|
{
|
|
//
|
|
// 摘要:
|
|
// Initializes a new instance of the MapToAttribute
|
|
// class.
|
|
//
|
|
// 参数:
|
|
// serviceType:
|
|
// Type of the service.
|
|
//
|
|
// lifetime:
|
|
// The lifetime.
|
|
//
|
|
// 异常:
|
|
// T:System.ArgumentNullException:
|
|
// Specified serviceType is null.
|
|
public MapToAttribute(Type serviceType, ServiceLifetime lifetime)
|
|
{
|
|
ServiceType = serviceType ?? throw new ArgumentNullException("serviceType");
|
|
Lifetime = lifetime;
|
|
}
|
|
|
|
//
|
|
// 摘要:
|
|
// Gets the type of the service.
|
|
//
|
|
// 值:
|
|
// The type of the service.
|
|
public Type ServiceType { get; }
|
|
//
|
|
// 摘要:
|
|
// Gets the lifetime.
|
|
//
|
|
// 值:
|
|
// The lifetime.
|
|
public ServiceLifetime Lifetime { get; }
|
|
}
|
|
}
|