Registering a service in Startup.Cs -how can I get a reference to it later in my WiseJ project ?

0
0

Trying to register an Actor System using AKKA.net in the latest WiseJ -cant figure out how to get access to it later in the code. I have been able to use a static class in older version of WiseJ -non Net Core. But reading online this may not work well anymore)

in startup.cs I have:

builder.Services.AddAkka(“SystemControlPoints”, (builder, provider) =>
{
builder

// Instantiate actors
.WithActors((system, registry) =>
{
// Props == formula for creating an actor
Props myProps = Props.Create<HelloActor>();

IActorRef myActor = system.ActorOf(myProps, “MyActor”);

registry.Register<HelloActor>(myActor);

// tell my actor to display a message via Fire-and-Forget messaging
myActor.Tell(“Hello, World!”);
});
});

  • You must to post comments
0
0

Hello Edmond,

To use the Microsoft Service container, you’ll have to register it like the following example:

// Register Microsoft's IServiceProvider with Wisej.NET.
Application.Services.AddService<IServiceProvider>(app.Services);

For the complete sample, please refer to our documentation covering Dependency Injection.

Let me know in case you need additional help!

Best Regards,

Alaa

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.