|
|
|
@ -0,0 +1,47 @@ |
|
|
|
|
namespace BlazorApp.Data |
|
|
|
|
{ |
|
|
|
|
public class SingletonService : IDisposable |
|
|
|
|
{ |
|
|
|
|
public Guid ID { get; set; } |
|
|
|
|
|
|
|
|
|
public SingletonService() |
|
|
|
|
{ |
|
|
|
|
ID = Guid.NewGuid(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine($"SingletonService was disposed (Guid: {this.ID.ToString()})"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public class TransientService : IDisposable |
|
|
|
|
{ |
|
|
|
|
public Guid ID { get; set; } |
|
|
|
|
|
|
|
|
|
public TransientService() |
|
|
|
|
{ |
|
|
|
|
ID = Guid.NewGuid(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine($"TransientService was disposed (Guid: {this.ID.ToString()})"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public class ScopedService : IDisposable |
|
|
|
|
{ |
|
|
|
|
public Guid ID { get; set; } |
|
|
|
|
|
|
|
|
|
public ScopedService() |
|
|
|
|
{ |
|
|
|
|
ID = Guid.NewGuid(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine($"ScopedService was disposed (Guid: {this.ID.ToString()})"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |