Class AppServiceContractAttribute
Marks an interface to be an application service contract. Application services are automatically identified by the composition and added to the container.
Inheritance
Implements
Inherited Members
Namespace: Kephas.Services
Assembly: Kephas.Core.dll
Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public class AppServiceContractAttribute : Attribute, IAppServiceInfo
Constructors
| Improve this Doc View SourceAppServiceContractAttribute()
Initializes a new instance of the AppServiceContractAttribute class.
Declaration
public AppServiceContractAttribute()
AppServiceContractAttribute(AppServiceLifetime)
Initializes a new instance of the AppServiceContractAttribute class.
Declaration
protected AppServiceContractAttribute(AppServiceLifetime lifetime)
Parameters
Type | Name | Description |
---|---|---|
AppServiceLifetime | lifetime | The lifetime. |
Fields
| Improve this Doc View SourceDefaultMetadataAttributeTypes
The default metadata attribute types.
Declaration
public static readonly IReadOnlyCollection<Type> DefaultMetadataAttributeTypes
Field Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyCollection<System.Type> |
EmptyMetadataAttributeTypes
The empty metadata attribute types.
Declaration
public static readonly IReadOnlyCollection<Type> EmptyMetadataAttributeTypes
Field Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyCollection<System.Type> |
Properties
| Improve this Doc View SourceAllowMultiple
Gets or sets a value indicating whether multiple services for this contract are allowed.
Declaration
public bool AllowMultiple { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
AsOpenGeneric
Gets or sets a value indicating whether the contract should be exported as an open generic.
Declaration
public bool AsOpenGeneric { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ContractType
Gets or sets the contract type of the export.
Declaration
public Type ContractType { get; set; }
Property Value
Type | Description |
---|---|
System.Type | The contract type of the export. |
Lifetime
Gets the application service lifetime.
Declaration
public AppServiceLifetime Lifetime { get; }
Property Value
Type | Description |
---|---|
AppServiceLifetime | The application service lifetime. |
MetadataAttributes
Gets or sets the supported metadata attributes.
Declaration
public Type[] MetadataAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.Type[] | The metadata attributes. |
Remarks
The metadata attributes are used to register the conventions for application services.
Methods
| Improve this Doc View SourceRegisterDefaultMetadataAttributeTypes(Type[])
Registers the provided metadata attribute types as default attributes.
Declaration
public static void RegisterDefaultMetadataAttributeTypes(params Type[] attributeTypes)
Parameters
Type | Name | Description |
---|---|---|
System.Type[] | attributeTypes | A variable-length parameters list containing attribute types. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents the current object. |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIAppServiceInfo.Instance
Gets the service instance.
Declaration
object IAppServiceInfo.Instance { get; }
Returns
Type | Description |
---|---|
System.Object | The service instance. |
IAppServiceInfo.InstanceFactory
Gets the service instance factory.
Declaration
Func<ICompositionContext, object> IAppServiceInfo.InstanceFactory { get; }
Returns
Type | Description |
---|---|
System.Func<ICompositionContext, System.Object> | The service instance factory. |
IAppServiceInfo.InstanceType
Gets the type of the service instance.
Declaration
Type IAppServiceInfo.InstanceType { get; }
Returns
Type | Description |
---|---|
System.Type | The type of the service instance. |