diff --git a/Syrette/ServiceContainer.cs b/Syrette/ServiceContainer.cs
index a247a6e..eca2483 100644
--- a/Syrette/ServiceContainer.cs
+++ b/Syrette/ServiceContainer.cs
@@ -1,5 +1,8 @@
namespace Syrette;
+///
+/// Container for managing service registrations and resolutions.
+///
public class ServiceContainer {
private readonly List descriptors = new();
private readonly Dictionary singletons = new();
@@ -13,6 +16,11 @@ public class ServiceContainer {
descriptors.Where(d => d.ServiceType == typeof(TServices))
.Select(d => d.ImplementationType).ToList();
+ ///
+ /// Registers a singleton service with its implementation.
+ ///
+ /// Interface the service is implementing
+ /// Implementation type of the service
public ServiceContainer AddSingleton()
where TImplementation : class, TInterface {
descriptors.Add(new ServiceDescriptor {
@@ -25,6 +33,11 @@ public class ServiceContainer {
return this;
}
+ ///
+ /// Registers a transient service with its implementation.
+ ///
+ /// Interface the service is implementing
+ /// Implementation type of the service
public ServiceContainer AddTransient()
where TImplementation : class, TInterface {
descriptors.Add(new ServiceDescriptor {
@@ -48,6 +61,11 @@ public class ServiceContainer {
return method.Invoke(this, null)!;
}
+ ///
+ /// Resolves and returns an instance of the requested service type.
+ ///
+ /// Interface type of the service being requested
+ /// Resolved service instance
public TInterface GetService() {
var descriptor = descriptors.FirstOrDefault(d => d.ServiceType == typeof(TInterface));
diff --git a/Syrette/ServiceDescriptor.cs b/Syrette/ServiceDescriptor.cs
index ca6b1f1..587efb6 100644
--- a/Syrette/ServiceDescriptor.cs
+++ b/Syrette/ServiceDescriptor.cs
@@ -1,8 +1,27 @@
namespace Syrette;
-public class ServiceDescriptor {
+///
+/// Describes a service for dependency injection, including its type, implementation, lifetime, and required dependencies.
+///
+public class ServiceDescriptor
+{
+ ///
+ /// Gets or sets the type of the service to be provided.
+ ///
public required Type ServiceType { get; set; }
+
+ ///
+ /// Gets or sets the concrete type that implements the service.
+ ///
public required Type ImplementationType { get; set; }
+
+ ///
+ /// Gets or sets the lifetime of the service (e.g., Singleton or Transient).
+ ///
public required ServiceLifetime Lifetime { get; set; }
+
+ ///
+ /// Gets or sets the list of types required by the implementation (dependencies).
+ ///
public List RequiredTypes { get; set; } = new();
}
\ No newline at end of file
diff --git a/Syrette/ServiceLifetime.cs b/Syrette/ServiceLifetime.cs
index b656b39..1902712 100644
--- a/Syrette/ServiceLifetime.cs
+++ b/Syrette/ServiceLifetime.cs
@@ -1,6 +1,15 @@
namespace Syrette;
+///
+/// Defines the lifetime of a service in dependency injection.
+///
public enum ServiceLifetime {
+ ///
+ /// Defines a singleton service, which is created once and shared throughout the application's lifetime.
+ ///
Lifetime,
+ ///
+ /// Defines a transient service, which is created anew each time it is requested.
+ ///
Transient
}
\ No newline at end of file
diff --git a/Syrette/Syrette.csproj b/Syrette/Syrette.csproj
index e608062..0f543d0 100644
--- a/Syrette/Syrette.csproj
+++ b/Syrette/Syrette.csproj
@@ -1,22 +1,32 @@
-
+
+
+ README.md
+ ./
+
+ net9.0latestenableenable
- 0.0.1-alpha
+ 0.0.1.1-alphaSyrette Lorefice SamueleSyrette is a minimalistic dependency injection library for C#. It aims to provide a simple and efficient way to achieve dependency injections in your applications without the overhead of larger frameworks.2025 Lorefice Samuelehttps://git.r3d.codes/REDCODE/Syrette
- https://git.r3d.codes/REDCODE/Syrette/src/branch/master/LICENSE
+ MIT
+ README.mdhttps://git.r3d.codes/REDCODE/Syrettegit
- DI, Dependency Injection
+ DI Dependency InjectionSamuele Lorefice
+ truetrue
-
+
+ true
+ bin\Release\Syrette.xml
+
diff --git a/Syrette/Syrette.csproj.DotSettings b/Syrette/Syrette.csproj.DotSettings
new file mode 100644
index 0000000..89316e4
--- /dev/null
+++ b/Syrette/Syrette.csproj.DotSettings
@@ -0,0 +1,2 @@
+
+ Library
\ No newline at end of file