question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Standard Dependency Injection for Actors

See original GitHub issue

Describe the proposal

The ActorService should instantiate actors through the ASP.Net Core DI container and inject the ActorId through a property or method.

Yes I know that you can use actorRuntime.RegisterActor<DemoActor>( (type) => new ActorService(type, (actorService, actorId) => new DemoActor(actorService, actorId)));

But the problem IMHO is that at the place you register the actor there is AFAIK no easy way to access the ASP.Net Core DI container.

Maybe there is another way to make the actor instantiation play better with dependency injection. I’m open for discussion.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tomkerkhovecommented, Jul 31, 2020

@amanbha Are there plans to provide this built-in so that I don’t have to use this?

I’d love to just inject an ILogger to use.

0reactions
amanbhacommented, Aug 12, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Akka.NET Dependency Injection Best Practices
DependencyInjection has become the de facto standard for how dependency ... We can easily create actors that depend on and dispose of these ......
Read more >
Understanding Dependency Injection in .NET Core
Dependency Injection : this is a design pattern to implement Inversion of Control. It allows you to inject the concrete implementation of a...
Read more >
Dependency Injection Best Practices for Akka.NET - YouTube
Best practices, patterns, and techniques for working with .NET dependency injection and Akka.NET actors via the Akka.
Read more >
Dependency Injection
Dependency Injection is a design pattern that allows an external object to create dependencies for a dependent object. Thus, the creation and binding...
Read more >
Dependency Injection with Akka actors : r/scala
Is there a standard concerning Akka Actors and Scala Classes? With Guice or Spring this would be quite boilerplate heavy, having to create ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found