Skip to content

Commit ff3c760

Browse files
- Updated IServiceProvider to use Results.
1 parent 7f15170 commit ff3c760

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/IServicesProvider.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface IServicesProvider
1919
/// <param name="lifetimeInstance"></param>
2020
/// <typeparam name="TSvcInterface"></typeparam>
2121
/// <typeparam name="TService"></typeparam>
22-
void RegisterServiceType<TSvcInterface, TService>(ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IService where TService : class, IService, TSvcInterface, new();
22+
FluentResults.Result RegisterServiceType<TSvcInterface, TService>(ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IService where TService : class, IService, TSvcInterface, new();
2323

2424
/// <summary>
2525
/// Registers a type as a service for a given interface that can be requested by name.
@@ -29,7 +29,7 @@ public interface IServicesProvider
2929
/// <param name="lifetimeInstance"></param>
3030
/// <typeparam name="TSvcInterface"></typeparam>
3131
/// <typeparam name="TService"></typeparam>
32-
void RegisterServiceType<TSvcInterface, TService>(string name, ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IService where TService : class, IService, TSvcInterface, new();
32+
FluentResults.Result RegisterServiceType<TSvcInterface, TService>(string name, ServiceLifetime lifetime, ILifetime lifetimeInstance = null) where TSvcInterface : class, IService where TService : class, IService, TSvcInterface, new();
3333

3434
/// <summary>
3535
/// Called whenever a new service type for a given interface is implemented.
@@ -57,21 +57,17 @@ public interface IServicesProvider
5757
/// <summary>
5858
/// Tries to get a service for the given interface, returns success/failure.
5959
/// </summary>
60-
/// <param name="service"></param>
61-
/// <param name="lifetime"></param>
6260
/// <typeparam name="TSvcInterface"></typeparam>
6361
/// <returns></returns>
64-
bool TryGetService<TSvcInterface>(out IService service) where TSvcInterface : class, IService;
62+
FluentResults.Result<TSvcInterface> GetService<TSvcInterface>() where TSvcInterface : class, IService;
6563

6664
/// <summary>
6765
/// Tries to get a service for the given name and interface, returns success/failure.
6866
/// </summary>
6967
/// <param name="name"></param>
70-
/// <param name="service"></param>
71-
/// <param name="lifetime"></param>
7268
/// <typeparam name="TSvcInterface"></typeparam>
7369
/// <returns></returns>
74-
bool TryGetService<TSvcInterface>(string name, out IService service) where TSvcInterface : class, IService;
70+
FluentResults.Result<TSvcInterface> GetService<TSvcInterface>(string name) where TSvcInterface : class, IService;
7571

7672
/// <summary>
7773
/// Called whenever a new service is created/instanced.
@@ -89,7 +85,7 @@ public interface IServicesProvider
8985
/// </summary>
9086
/// <typeparam name="TSvc"></typeparam>
9187
/// <returns></returns>
92-
ImmutableArray<TSvc> GetAllServices<TSvc>() where TSvc : class, IService;
88+
FluentResults.Result<ImmutableArray<TSvc>> GetAllServices<TSvc>() where TSvc : class, IService;
9389

9490
#endregion
9591

@@ -99,7 +95,7 @@ public interface IServicesProvider
9995
/// <summary>
10096
/// Notes: Internal use only if hosted by LuaCsForBarotrauma. Disposes of all services and resets DI container. Warning: unable to dispose of services held by other objects.
10197
/// </summary>
102-
void DisposeAndReset();
98+
void Reset();
10399

104100
#endregion
105101
}

0 commit comments

Comments
 (0)