Skip to content

Commit 58bafc9

Browse files
committed
Update to 1.3.1 (Hotfix)
- Added: Packaged with XML Documentation files. - Refactor: Reflected changes to concrete classes, into API endpoint interfaces.
1 parent b1626ff commit 58bafc9

File tree

3 files changed

+156
-37
lines changed

3 files changed

+156
-37
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
using System;
2+
3+
namespace ApacheTech.Common.DependencyInjection.Abstractions
4+
{
5+
public partial interface IServiceCollection
6+
{
7+
/// <summary>
8+
/// Registers a raw service descriptor, pre-populated with meta-data for the service.
9+
/// </summary>
10+
/// <param name="descriptor">The pre-populated descriptor for the service to register.</param>
11+
/// <seealso cref="ServiceDescriptor"/>
12+
[Obsolete("Use Add() instead. Method will be removed during in the major release cycle.")]
13+
void Register(ServiceDescriptor descriptor);
14+
15+
/// <summary>
16+
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
17+
/// </summary>
18+
/// <param name="implementationType">The type of implementation to use.</param>
19+
/// <seealso cref="ServiceLifetime.Singleton"/>
20+
[Obsolete("Use AddSingleton() instead. Method will be removed during in the major release cycle.")]
21+
void RegisterSingleton(Type implementationType);
22+
23+
/// <summary>
24+
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
25+
/// </summary>
26+
/// <param name="serviceType">The type of service to register.</param>
27+
/// <param name="implementationType">The type of implementation to use.</param>
28+
/// <seealso cref="ServiceLifetime.Singleton"/>
29+
[Obsolete("Use AddSingleton() instead. Method will be removed during in the major release cycle.")]
30+
void RegisterSingleton(Type serviceType, Type implementationType);
31+
32+
/// <summary>
33+
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
34+
/// </summary>
35+
/// <typeparam name="TService">The type of service to register.</typeparam>
36+
/// <seealso cref="ServiceLifetime.Singleton"/>
37+
[Obsolete("Use AddSingleton() instead. Method will be removed during in the major release cycle.")]
38+
void RegisterSingleton<TService>() where TService : class;
39+
40+
/// <summary>
41+
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
42+
/// </summary>
43+
/// <typeparam name="TService">The type of service to register.</typeparam>
44+
/// <typeparam name="TImplementation">The type of implementation to use.</typeparam>
45+
/// <seealso cref="ServiceLifetime.Singleton"/>
46+
[Obsolete("Use AddSingleton() instead. Method will be removed during in the major release cycle.")]
47+
void RegisterSingleton<TService, TImplementation>() where TImplementation : TService;
48+
49+
/// <summary>
50+
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
51+
/// </summary>
52+
/// <typeparam name="TService">The type of service to register.</typeparam>
53+
/// <param name="implementationFactory">The factory that creates the service.</param>
54+
/// <seealso cref="ServiceLifetime.Singleton"/>
55+
[Obsolete("Use AddSingleton() instead. Method will be removed during in the major release cycle.")]
56+
void RegisterSingleton<TService>(Func<IServiceResolver, TService> implementationFactory) where TService : class;
57+
58+
/// <summary>
59+
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
60+
/// </summary>
61+
/// <typeparam name="TService">The instance to register.</typeparam>
62+
/// <seealso cref="ServiceLifetime.Singleton"/>
63+
[Obsolete("Use AddSingleton() instead. Method will be removed during in the major release cycle.")]
64+
void RegisterSingleton<TService>(TService implementation);
65+
66+
/// <summary>
67+
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
68+
/// </summary>
69+
/// <param name="implementationType">The type of implementation to use.</param>
70+
/// <seealso cref="ServiceLifetime.Transient"/>
71+
[Obsolete("Use AddTransient() instead. Method will be removed during in the major release cycle.")]
72+
void RegisterTransient(Type implementationType);
73+
74+
/// <summary>
75+
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
76+
/// </summary>
77+
/// <param name="serviceType">The type of service to register.</param>
78+
/// <param name="implementationType">The type of implementation to use.</param>
79+
/// <seealso cref="ServiceLifetime.Transient"/>
80+
[Obsolete("Use AddTransient() instead. Method will be removed during in the major release cycle.")]
81+
void RegisterTransient(Type serviceType, Type implementationType);
82+
83+
/// <summary>
84+
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
85+
/// </summary>
86+
/// <typeparam name="TService">The type of service to register.</typeparam>
87+
/// <seealso cref="ServiceLifetime.Transient"/>
88+
[Obsolete("Use AddTransient() instead. Method will be removed during in the major release cycle.")]
89+
void RegisterTransient<TService>() where TService : class;
90+
91+
/// <summary>
92+
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
93+
/// </summary>
94+
/// <typeparam name="TService">The type of service to register.</typeparam>
95+
/// <typeparam name="TImplementation">The type of implementation to use.</typeparam>
96+
/// <seealso cref="ServiceLifetime.Transient"/>
97+
[Obsolete("Use AddTransient() instead. Method will be removed during in the major release cycle.")]
98+
void RegisterTransient<TService, TImplementation>() where TImplementation : TService;
99+
100+
/// <summary>
101+
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
102+
/// </summary>
103+
/// <typeparam name="TService">The type of service to register.</typeparam>
104+
/// <param name="implementationFactory">The factory that creates the service.</param>
105+
/// <seealso cref="ServiceLifetime.Transient" />
106+
[Obsolete("Use AddTransient() instead. Method will be removed during in the major release cycle.")]
107+
void RegisterTransient<TService>(Func<IServiceResolver, TService> implementationFactory) where TService : class;
108+
}
109+
}

ApacheTech.Common.DependencyInjection/Abstractions/IServiceCollection.cs

+36-36
Original file line numberDiff line numberDiff line change
@@ -6,100 +6,100 @@
66
namespace ApacheTech.Common.DependencyInjection.Abstractions
77
{
88
/// <summary>
9-
/// An IOC Container, which holds references to registered types of services, and their instances.
9+
/// An IOC Container, which holds references to Added types of services, and their instances.
1010
/// </summary>
11-
public interface IServiceCollection
11+
public partial interface IServiceCollection
1212
{
1313
/// <summary>
14-
/// Registers a raw service descriptor, pre-populated with meta-data for the service.
14+
/// Adds a raw service descriptor, pre-populated with meta-data for the service.
1515
/// </summary>
16-
/// <param name="descriptor">The pre-populated descriptor for the service to register.</param>
16+
/// <param name="descriptor">The pre-populated descriptor for the service to add.</param>
1717
/// <seealso cref="ServiceDescriptor"/>
18-
void Register(ServiceDescriptor descriptor);
18+
void Add(ServiceDescriptor descriptor);
1919

2020
/// <summary>
21-
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
21+
/// Adds a service as a singleton. Only one instance of the service will be created within the container.
2222
/// </summary>
2323
/// <param name="implementationType">The type of implementation to use.</param>
2424
/// <seealso cref="ServiceLifetime.Singleton"/>
25-
void RegisterSingleton(Type implementationType);
25+
void AddSingleton(Type implementationType);
2626

2727
/// <summary>
28-
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
28+
/// Adds a service as a singleton. Only one instance of the service will be created within the container.
2929
/// </summary>
30-
/// <param name="serviceType">The type of service to register.</param>
30+
/// <param name="serviceType">The type of service to add.</param>
3131
/// <param name="implementationType">The type of implementation to use.</param>
3232
/// <seealso cref="ServiceLifetime.Singleton"/>
33-
void RegisterSingleton(Type serviceType, Type implementationType);
33+
void AddSingleton(Type serviceType, Type implementationType);
3434

3535
/// <summary>
36-
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
36+
/// Adds a service as a singleton. Only one instance of the service will be created within the container.
3737
/// </summary>
38-
/// <typeparam name="TService">The type of service to register.</typeparam>
38+
/// <typeparam name="TService">The type of service to add.</typeparam>
3939
/// <seealso cref="ServiceLifetime.Singleton"/>
4040
///
41-
void RegisterSingleton<TService>() where TService : class;
41+
void AddSingleton<TService>() where TService : class;
4242

4343
/// <summary>
44-
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
44+
/// Adds a service as a singleton. Only one instance of the service will be created within the container.
4545
/// </summary>
46-
/// <typeparam name="TService">The type of service to register.</typeparam>
46+
/// <typeparam name="TService">The type of service to add.</typeparam>
4747
/// <typeparam name="TImplementation">The type of implementation to use.</typeparam>
4848
/// <seealso cref="ServiceLifetime.Singleton"/>
49-
void RegisterSingleton<TService, TImplementation>() where TImplementation : TService;
49+
void AddSingleton<TService, TImplementation>() where TImplementation : TService;
5050

5151
/// <summary>
52-
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
52+
/// Adds a service as a singleton. Only one instance of the service will be created within the container.
5353
/// </summary>
54-
/// <typeparam name="TService">The type of service to register.</typeparam>
54+
/// <typeparam name="TService">The type of service to add.</typeparam>
5555
/// <param name="implementationFactory">The factory that creates the service.</param>
5656
/// <seealso cref="ServiceLifetime.Singleton"/>
57-
void RegisterSingleton<TService>(Func<IServiceResolver, TService> implementationFactory) where TService : class;
57+
void AddSingleton<TService>(Func<IServiceResolver, TService> implementationFactory) where TService : class;
5858

5959
/// <summary>
60-
/// Registers a service as a singleton. Only one instance of the service will be created within the container.
60+
/// Adds a service as a singleton. Only one instance of the service will be created within the container.
6161
/// </summary>
62-
/// <typeparam name="TService">The instance to register.</typeparam>
62+
/// <typeparam name="TService">The instance to add.</typeparam>
6363
/// <seealso cref="ServiceLifetime.Singleton"/>
64-
void RegisterSingleton<TService>(TService implementation);
64+
void AddSingleton<TService>(TService implementation);
6565

6666
/// <summary>
67-
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
67+
/// Adds a service as a singleton. A new instance of the service will be created each time it is resolved.
6868
/// </summary>
6969
/// <param name="implementationType">The type of implementation to use.</param>
7070
/// <seealso cref="ServiceLifetime.Transient"/>
71-
void RegisterTransient(Type implementationType);
71+
void AddTransient(Type implementationType);
7272

7373
/// <summary>
74-
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
74+
/// Adds a service as a singleton. A new instance of the service will be created each time it is resolved.
7575
/// </summary>
76-
/// <param name="serviceType">The type of service to register.</param>
76+
/// <param name="serviceType">The type of service to add.</param>
7777
/// <param name="implementationType">The type of implementation to use.</param>
7878
/// <seealso cref="ServiceLifetime.Transient"/>
79-
void RegisterTransient(Type serviceType, Type implementationType);
79+
void AddTransient(Type serviceType, Type implementationType);
8080

8181
/// <summary>
82-
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
82+
/// Adds a service as a singleton. A new instance of the service will be created each time it is resolved.
8383
/// </summary>
84-
/// <typeparam name="TService">The type of service to register.</typeparam>
84+
/// <typeparam name="TService">The type of service to add.</typeparam>
8585
/// <seealso cref="ServiceLifetime.Transient"/>
86-
void RegisterTransient<TService>() where TService : class;
86+
void AddTransient<TService>() where TService : class;
8787

8888
/// <summary>
89-
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
89+
/// Adds a service as a singleton. A new instance of the service will be created each time it is resolved.
9090
/// </summary>
91-
/// <typeparam name="TService">The type of service to register.</typeparam>
91+
/// <typeparam name="TService">The type of service to add.</typeparam>
9292
/// <typeparam name="TImplementation">The type of implementation to use.</typeparam>
9393
/// <seealso cref="ServiceLifetime.Transient"/>
94-
void RegisterTransient<TService, TImplementation>() where TImplementation : TService;
94+
void AddTransient<TService, TImplementation>() where TImplementation : TService;
9595

9696
/// <summary>
97-
/// Registers a service as a singleton. A new instance of the service will be created each time it is resolved.
97+
/// Adds a service as a singleton. A new instance of the service will be created each time it is resolved.
9898
/// </summary>
99-
/// <typeparam name="TService">The type of service to register.</typeparam>
99+
/// <typeparam name="TService">The type of service to add.</typeparam>
100100
/// <param name="implementationFactory">The factory that creates the service.</param>
101101
/// <seealso cref="ServiceLifetime.Transient"/>
102-
void RegisterTransient<TService>(Func<IServiceResolver, TService> implementationFactory) where TService : class;
102+
void AddTransient<TService>(Func<IServiceResolver, TService> implementationFactory) where TService : class;
103103

104104
/// <summary>
105105
/// Build a service resolver, to access services within this collection.

ApacheTech.Common.DependencyInjection/ApacheTech.Common.DependencyInjection.csproj

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Version>1.3.0.0</Version>
4+
<Version>1.3.1.0</Version>
55

66
<ApplicationIcon>__Icon.ico</ApplicationIcon>
77
<AssemblyName>ApacheTech.Common.DependencyInjection</AssemblyName>
@@ -39,6 +39,16 @@
3939

4040
<TargetFramework>netstandard2.0</TargetFramework>
4141
<Title>Minimal Dependency Injection Engine</Title>
42+
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
43+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
44+
</PropertyGroup>
45+
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
47+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
48+
</PropertyGroup>
49+
50+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
51+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
4252
</PropertyGroup>
4353

4454
<ItemGroup>

0 commit comments

Comments
 (0)