• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン1b284cdef6f5db2ffd340fc0963c2fa76eb6b9d2 (tree)
日時2022-08-12 00:19:55
作者yoshy <yoshy.org.bitbucket@gz.j...>
コミッターyoshy

ログメッセージ

[MOD] CleanAuLait から Prism 関連の実装を分離

変更サマリ

差分

--- a/Adaptor/Boundary/Controller/IAsyncHandlerContext.cs
+++ b/Adaptor/Boundary/Controller/IAsyncHandlerContext.cs
@@ -1,7 +1,7 @@
11 using CleanAuLait.Adaptor.Boundary.Controller.Handler;
2+using CleanAuLait.Adaptor.Controller.DI;
23 using CleanAuLait.UseCase.Request;
34 using CleanAuLait.UseCase.Response;
4-using Prism.Ioc;
55
66 namespace CleanAuLait.Adaptor.Boundary.Controller
77 {
@@ -9,7 +9,7 @@ namespace CleanAuLait.Adaptor.Boundary.Controller
99 {
1010 Queue<IAsyncRequestHandler> HandlerQueue { get; }
1111
12- IScopedProvider ScopedProvider { get; }
12+ IRequestScopedProvider ScopedProvider { get; }
1313
1414 Task<UseCaseResponse> HandleNextAsync(UseCaseRequest req, IAsyncHandlerContext context);
1515 }
--- a/Adaptor/Boundary/Controller/IAsyncHandlerContextFactory.cs
+++ b/Adaptor/Boundary/Controller/IAsyncHandlerContextFactory.cs
@@ -1,10 +1,10 @@
1-using Prism.Ioc;
1+using CleanAuLait.Adaptor.Controller.DI;
22
33 namespace CleanAuLait.Adaptor.Boundary.Controller
44 {
55 public interface IAsyncHandlerContextFactory : IAttachHandlerQueueMap
66 {
77 IAsyncHandlerContext Create(
8- string handlerTypesName,IScopedProvider scopedProvider);
8+ string handlerTypesName, IRequestScopedProvider scopedProvider);
99 }
1010 }
\ No newline at end of file
--- a/Adaptor/Boundary/Controller/IHandlerContext.cs
+++ b/Adaptor/Boundary/Controller/IHandlerContext.cs
@@ -1,7 +1,7 @@
11 using CleanAuLait.Adaptor.Boundary.Controller.Handler;
2+using CleanAuLait.Adaptor.Controller.DI;
23 using CleanAuLait.UseCase.Request;
34 using CleanAuLait.UseCase.Response;
4-using Prism.Ioc;
55
66 namespace CleanAuLait.Adaptor.Boundary.Controller
77 {
@@ -9,7 +9,7 @@ namespace CleanAuLait.Adaptor.Boundary.Controller
99 {
1010 Queue<IRequestHandler> HandlerQueue { get; }
1111
12- IScopedProvider ScopedProvider { get; }
12+ IRequestScopedProvider ScopedProvider { get; }
1313
1414 UseCaseResponse HandleNext(UseCaseRequest req, IHandlerContext context);
1515 }
--- a/Adaptor/Boundary/Controller/IHandlerContextFactory.cs
+++ b/Adaptor/Boundary/Controller/IHandlerContextFactory.cs
@@ -1,10 +1,10 @@
1-using Prism.Ioc;
1+using CleanAuLait.Adaptor.Controller.DI;
22
33 namespace CleanAuLait.Adaptor.Boundary.Controller
44 {
55 public interface IHandlerContextFactory : IAttachHandlerQueueMap
66 {
77 IHandlerContext Create(
8- string handlerTypesName, IScopedProvider scopedProvider);
8+ string handlerTypesName, IRequestScopedProvider scopedProvider);
99 }
1010 }
\ No newline at end of file
--- a/Adaptor/Controller/AbstractAsyncWindowController.cs
+++ b/Adaptor/Controller/AbstractAsyncWindowController.cs
@@ -1,8 +1,7 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
2-using CleanAuLait.Core.DI;
2+using CleanAuLait.Adaptor.Controller.DI;
33 using CleanAuLait.UseCase.Request;
44 using CleanAuLait.UseCase.Response;
5-using Prism.Ioc;
65
76 namespace CleanAuLait.Adaptor.Controller
87 {
@@ -28,7 +27,7 @@ namespace CleanAuLait.Adaptor.Controller
2827
2928 protected async Task<UseCaseResponse> ExecuteAsync(string handlerQueueName, UseCaseRequest req)
3029 {
31- using IScopedProvider scope = scopedGenerator.CreateScope();
30+ using IRequestScopedProvider scope = scopedGenerator.CreateScope();
3231 IAsyncHandlerContext context = contextFactory.Create(handlerQueueName, scope);
3332
3433 return await context.HandleNextAsync(req, context);
--- a/Adaptor/Controller/AbstractHandlerContextFactoryRegistrar.cs
+++ b/Adaptor/Controller/AbstractHandlerContextFactoryRegistrar.cs
@@ -1,5 +1,4 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
2-using Prism.Ioc;
32
43 namespace CleanAuLait.Adaptor.Controller
54 {
@@ -14,9 +13,11 @@ namespace CleanAuLait.Adaptor.Controller
1413 map.Add(factoryName, handlerTypes);
1514 }
1615
17- public void Register(IContainerRegistry registry)
16+ public abstract void Register();
17+
18+ protected Func<IFACTORY> CreateFactoryFactory()
1819 {
19- registry.RegisterSingleton<IFACTORY>(() =>
20+ return () =>
2021 {
2122 IFACTORY factory = new FACTORY
2223 {
@@ -24,7 +25,7 @@ namespace CleanAuLait.Adaptor.Controller
2425 };
2526
2627 return factory;
27- });
28+ };
2829 }
2930 }
3031 }
--- a/Adaptor/Controller/AbstractWindowController.cs
+++ b/Adaptor/Controller/AbstractWindowController.cs
@@ -1,8 +1,7 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
2-using CleanAuLait.Core.DI;
2+using CleanAuLait.Adaptor.Controller.DI;
33 using CleanAuLait.UseCase.Request;
44 using CleanAuLait.UseCase.Response;
5-using Prism.Ioc;
65
76 namespace CleanAuLait.Adaptor.Controller
87 {
@@ -32,7 +31,7 @@ namespace CleanAuLait.Adaptor.Controller
3231 {
3332 lock (lockExecute)
3433 {
35- using IScopedProvider scope = this.scopedGenerator.CreateScope();
34+ using IRequestScopedProvider scope = this.scopedGenerator.CreateScope();
3635 IHandlerContext context = this.contextFactory.Create(handlerQueueName, scope);
3736
3837 return context.HandleNext(req, context);
--- a/Adaptor/Controller/AsyncHandlerContextFactory.cs
+++ b/Adaptor/Controller/AsyncHandlerContextFactory.cs
@@ -1,8 +1,8 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
22 using CleanAuLait.Adaptor.Boundary.Controller.Handler;
3+using CleanAuLait.Adaptor.Controller.DI;
34 using CleanAuLait.Adaptor.Controller.Handler;
45 using CleanAuLait.Core.DI;
5-using Prism.Ioc;
66
77 namespace CleanAuLait.Adaptor.Controller
88 {
@@ -10,7 +10,7 @@ namespace CleanAuLait.Adaptor.Controller
1010 {
1111 public IDictionary<string, IEnumerable<Type>> HandlerQueueMap { get; set; }
1212
13- public IAsyncHandlerContext Create(string handlerQueueName, IScopedProvider scopedProvider)
13+ public IAsyncHandlerContext Create(string handlerQueueName, IRequestScopedProvider scopedProvider)
1414 {
1515 if (!HandlerQueueMap.TryGetValue(handlerQueueName, out IEnumerable<Type> handlerTypes))
1616 {
@@ -21,7 +21,7 @@ namespace CleanAuLait.Adaptor.Controller
2121 }
2222
2323 protected static IAsyncHandlerContext CreateInternal(
24- IScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
24+ IRequestScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
2525 {
2626 Queue<IAsyncRequestHandler> queue = CreateHandlerQueue(scopedProvider, handlerTypes);
2727
@@ -31,7 +31,7 @@ namespace CleanAuLait.Adaptor.Controller
3131 }
3232
3333 protected static Queue<IAsyncRequestHandler> CreateHandlerQueue(
34- IScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
34+ IRequestScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
3535 {
3636 Queue<IAsyncRequestHandler> queue = new();
3737
--- a/Adaptor/Controller/AsyncHandlerContextFactoryRegistrar.cs
+++ /dev/null
@@ -1,9 +0,0 @@
1-using CleanAuLait.Adaptor.Boundary.Controller;
2-
3-namespace CleanAuLait.Adaptor.Controller
4-{
5- public class AsyncHandlerContextFactoryRegistrar :
6- AbstractHandlerContextFactoryRegistrar<IAsyncHandlerContextFactory, AsyncHandlerContextFactory>
7- {
8- }
9-}
--- a/Adaptor/Controller/AsyncSimpleWindowController.cs
+++ b/Adaptor/Controller/AsyncSimpleWindowController.cs
@@ -1,5 +1,5 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
2-using CleanAuLait.Core.DI;
2+using CleanAuLait.Adaptor.Controller.DI;
33
44 namespace CleanAuLait.Adaptor.Controller
55 {
--- /dev/null
+++ b/Adaptor/Controller/DI/IRequestScopeGenerator.cs
@@ -0,0 +1,7 @@
1+namespace CleanAuLait.Adaptor.Controller.DI
2+{
3+ public interface IRequestScopeGenerator
4+ {
5+ IRequestScopedProvider CreateScope();
6+ }
7+}
\ No newline at end of file
--- /dev/null
+++ b/Adaptor/Controller/DI/IRequestScopedProvider.cs
@@ -0,0 +1,7 @@
1+namespace CleanAuLait.Adaptor.Controller.DI
2+{
3+ public interface IRequestScopedProvider : IDisposable
4+ {
5+ object Resolve(Type type);
6+ }
7+}
--- a/Adaptor/Controller/Handler/AsyncHandlerContext.cs
+++ b/Adaptor/Controller/Handler/AsyncHandlerContext.cs
@@ -1,17 +1,17 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
22 using CleanAuLait.Adaptor.Boundary.Controller.Handler;
3+using CleanAuLait.Adaptor.Controller.DI;
34 using CleanAuLait.UseCase.Request;
45 using CleanAuLait.UseCase.Response;
5-using Prism.Ioc;
66
77 namespace CleanAuLait.Adaptor.Controller.Handler
88 {
99 public class AsyncHandlerContext : IAsyncHandlerContext
1010 {
1111 public Queue<IAsyncRequestHandler> HandlerQueue { get; }
12- public IScopedProvider ScopedProvider { get; }
12+ public IRequestScopedProvider ScopedProvider { get; }
1313
14- public AsyncHandlerContext(Queue<IAsyncRequestHandler> queue, IScopedProvider scopedProvider)
14+ public AsyncHandlerContext(Queue<IAsyncRequestHandler> queue, IRequestScopedProvider scopedProvider)
1515 {
1616 this.HandlerQueue = queue;
1717 this.ScopedProvider = scopedProvider;
--- a/Adaptor/Controller/Handler/HandlerContext.cs
+++ b/Adaptor/Controller/Handler/HandlerContext.cs
@@ -1,17 +1,17 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
22 using CleanAuLait.Adaptor.Boundary.Controller.Handler;
3+using CleanAuLait.Adaptor.Controller.DI;
34 using CleanAuLait.UseCase.Request;
45 using CleanAuLait.UseCase.Response;
5-using Prism.Ioc;
66
77 namespace CleanAuLait.Adaptor.Controller.Handler
88 {
99 public class HandlerContext : IHandlerContext
1010 {
1111 public Queue<IRequestHandler> HandlerQueue { get; }
12- public IScopedProvider ScopedProvider { get; }
12+ public IRequestScopedProvider ScopedProvider { get; }
1313
14- public HandlerContext(Queue<IRequestHandler> queue, IScopedProvider scopedProvider)
14+ public HandlerContext(Queue<IRequestHandler> queue, IRequestScopedProvider scopedProvider)
1515 {
1616 this.HandlerQueue = queue;
1717 this.ScopedProvider = scopedProvider;
--- a/Adaptor/Controller/HandlerContextFactory.cs
+++ b/Adaptor/Controller/HandlerContextFactory.cs
@@ -1,8 +1,8 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
22 using CleanAuLait.Adaptor.Boundary.Controller.Handler;
3+using CleanAuLait.Adaptor.Controller.DI;
34 using CleanAuLait.Adaptor.Controller.Handler;
45 using CleanAuLait.Core.DI;
5-using Prism.Ioc;
66
77 namespace CleanAuLait.Adaptor.Controller
88 {
@@ -10,7 +10,7 @@ namespace CleanAuLait.Adaptor.Controller
1010 {
1111 public IDictionary<string, IEnumerable<Type>> HandlerQueueMap { get; set; }
1212
13- public IHandlerContext Create(string handlerQueueName, IScopedProvider scopedProvider)
13+ public IHandlerContext Create(string handlerQueueName, IRequestScopedProvider scopedProvider)
1414 {
1515 if (!HandlerQueueMap.TryGetValue(handlerQueueName, out IEnumerable<Type> handlerTypes))
1616 {
@@ -21,7 +21,7 @@ namespace CleanAuLait.Adaptor.Controller
2121 }
2222
2323 protected static IHandlerContext CreateInternal(
24- IScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
24+ IRequestScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
2525 {
2626 Queue<IRequestHandler> queue = CreateHandlerQueue(scopedProvider, handlerTypes);
2727
@@ -31,7 +31,7 @@ namespace CleanAuLait.Adaptor.Controller
3131 }
3232
3333 protected static Queue<IRequestHandler> CreateHandlerQueue(
34- IScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
34+ IRequestScopedProvider scopedProvider, IEnumerable<Type> handlerTypes)
3535 {
3636 Queue<IRequestHandler> queue = new();
3737
--- a/Adaptor/Controller/HandlerContextFactoryRegistrar.cs
+++ /dev/null
@@ -1,9 +0,0 @@
1-using CleanAuLait.Adaptor.Boundary.Controller;
2-
3-namespace CleanAuLait.Adaptor.Controller
4-{
5- public class HandlerContextFactoryRegistrar :
6- AbstractHandlerContextFactoryRegistrar<IHandlerContextFactory, HandlerContextFactory>
7- {
8- }
9-}
--- a/Adaptor/Controller/Router/AbstractUseCaseRouter.cs
+++ b/Adaptor/Controller/Router/AbstractUseCaseRouter.cs
@@ -1,7 +1,7 @@
1-using CleanAuLait.Core.DI;
1+using CleanAuLait.Adaptor.Controller.DI;
2+using CleanAuLait.Core.DI;
23 using CleanAuLait.UseCase.Boundary.Interactor;
34 using NLog;
4-using Prism.Ioc;
55
66 namespace CleanAuLait.Adaptor.Controller.Router
77 {
@@ -9,7 +9,7 @@ namespace CleanAuLait.Adaptor.Controller.Router
99 {
1010 private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
1111
12- protected T GetComponent(IScopedProvider scopedProvider, IUseCaseRouterAware req)
12+ protected T GetComponent(IRequestScopedProvider scopedProvider, IUseCaseRouterAware req)
1313 {
1414 Type interactorType = req.GetInteractorType();
1515
@@ -19,14 +19,7 @@ namespace CleanAuLait.Adaptor.Controller.Router
1919 return default;
2020 }
2121
22- try
23- {
24- return (T)scopedProvider.Resolve(interactorType);
25- }
26- catch (ContainerResolutionException e)
27- {
28- throw new DIException(e);
29- }
22+ return (T)scopedProvider.Resolve(interactorType);
3023 }
3124 }
3225 }
\ No newline at end of file
--- a/Adaptor/Controller/SimpleWindowController.cs
+++ b/Adaptor/Controller/SimpleWindowController.cs
@@ -1,5 +1,5 @@
11 using CleanAuLait.Adaptor.Boundary.Controller;
2-using CleanAuLait.Core.DI;
2+using CleanAuLait.Adaptor.Controller.DI;
33
44 namespace CleanAuLait.Adaptor.Controller
55 {
--- a/CleanAuLait.csproj
+++ b/CleanAuLait.csproj
@@ -15,9 +15,7 @@
1515
1616 <ItemGroup>
1717 <PackageReference Include="AutoMapper" Version="11.0.1" />
18- <PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
1918 <PackageReference Include="NLog" Version="5.0.1" />
20- <PackageReference Include="Prism.Core" Version="8.1.97" />
2119 <PackageReference Include="ReactiveProperty" Version="8.1.2" />
2220 </ItemGroup>
2321
--- a/CleanAuLaitModule.cs
+++ /dev/null
@@ -1,36 +0,0 @@
1-using CleanAuLait.Core.DI;
2-using CleanAuLait.Core.Resource;
3-using NLog;
4-using Prism.Ioc;
5-using Prism.Modularity;
6-
7-namespace CleanAuLait
8-{
9- public class CleanAuLaitModule: IModule
10- {
11- private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
12-
13- public void RegisterTypes(IContainerRegistry containerRegistry)
14- {
15- //
16- // Controller
17- //
18-
19- containerRegistry.RegisterSingleton<IRequestScopeGenerator, RequestScopeGenerator>();
20-
21- ///
22- /// Resources
23- ///
24-
25- containerRegistry.RegisterSingleton<ICaptionFormatter, CaptionFormatter>();
26-
27- logger.Trace("RegisterTypes end");
28- }
29-
30- public void OnInitialized(IContainerProvider containerProvider)
31- {
32- // NOP
33- }
34-
35- }
36-}
\ No newline at end of file
--- a/Core/DI/DIException.cs
+++ b/Core/DI/DIException.cs
@@ -3,7 +3,7 @@
33 namespace CleanAuLait.Core.DI
44 {
55 [Serializable]
6- internal class DIException : Exception
6+ public class DIException : Exception
77 {
88 public DIException()
99 {
--- a/Core/DI/IRequestScopeGenerator.cs
+++ /dev/null
@@ -1,9 +0,0 @@
1-using Prism.Ioc;
2-
3-namespace CleanAuLait.Core.DI
4-{
5- public interface IRequestScopeGenerator
6- {
7- IScopedProvider CreateScope();
8- }
9-}
\ No newline at end of file
--- a/Core/DI/RequestScopeGenerator.cs
+++ /dev/null
@@ -1,24 +0,0 @@
1-using Prism.Ioc;
2-
3-namespace CleanAuLait.Core.DI
4-{
5- public class RequestScopeGenerator : IRequestScopeGenerator
6- {
7- public IScopedProvider CreateScope()
8- {
9- try
10- {
11- return GetContainer().CreateScope();
12- }
13- catch (Exception e)
14- {
15- throw new DIException(e);
16- }
17- }
18-
19- protected virtual IContainerProvider GetContainer()
20- {
21- return ContainerLocator.Container;
22- }
23- }
24-}