Issue
I am attempting to update a Prism 8.1 app to use Shiny v2.
In trying to turn one of my services into a Job I keep getting a container resolution error (using Unity). I am not sure what the pattern is for registering platform implementations of services. The Job has a service that is from my platform project but at the time the services.RegisterJob()
is called I guess the platform initializer has not run.
Can someone post an example of how you are supposed to register platform implementations with Shiny?
Solution
Well, I'm not sure if this is the intended design but I solved the platform services this way.
I added a constructor parameter to my ShinyStartup
like this:
public Startup(IPlatformInitializer platformInitializer) : base(PrismContainerExtension.Current)
{
_platformInitializer = platformInitializer;
}
and then in my AppDelegate
I used this:
Shiny.ShinyHost.Init(new Shiny.ApplePlatform(), new Startup(new iOSInitializer()));
Where iOSInitializer
is my Prism IPlatformInitializer
.
Then in Startup
I added:
protected override void RegisterServices(IContainerRegistry containerRegistry)
{
_platformInitializer.RegisterTypes(containerRegistry);
...
}
As far as the IJob
not resolving dependencies when using RegisterJob
, I moved job registration to App.OnStart
using IJobManager.Register
and it works. Also not sure if this is the intended design.
I did all my container wire up before calling RegisterJob
and it still failed to resolve so there must be something under the covers that is happening in the Prism+Shiny world.
Answered By - jmichas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.