-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add LifeCycle to FluxorOptions and use in registration (#287)
* Add LifeCycle (Scoped/Singleton) to FluxorOptions and use the life cycle value when registering Fluxor components.
- Loading branch information
1 parent
cb318ff
commit fa8763e
Showing
15 changed files
with
290 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Fluxor | ||
{ | ||
public enum StoreLifetime | ||
{ | ||
Scoped, | ||
Singleton | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
Source/Fluxor/DependencyInjection/ServiceRegistration/ReducerClassRegistration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Fluxor.Extensions; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Fluxor.DependencyInjection.ServiceRegistration | ||
{ | ||
internal static class ReducerClassRegistration | ||
{ | ||
public static void Register( | ||
IServiceCollection services, | ||
ReducerClassInfo[] reducerClassInfos) | ||
ReducerClassInfo[] reducerClassInfos, | ||
FluxorOptions options) | ||
{ | ||
foreach (ReducerClassInfo reducerClassInfo in reducerClassInfos) | ||
services.AddScoped(serviceType: reducerClassInfo.ImplementingType); | ||
services.Add(serviceType: reducerClassInfo.ImplementingType, options: options); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.