26

Dependency Injection Best Practices for Akka.NET

 3 years ago
source link: https://www.youtube.com/watch?v=ttMhi-murHc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Dependency Injection Best Practices for Akka.NET

550 views
•Jan 20, 2021

Best practices, patterns, and techniques for working with .NET dependency injection and Akka.NET actors via the Akka.DependencyInjection library.

Documentation: https://getakka.net/articles/actors/d...​ Blog post: https://petabridge.com/blog/akkadotne...

If you have any questions or comments, please leave them in the comments!

Akka.NET DI Overview (0:00​) Actor Dependency Injection Demo (1:01​) DI + Non-DI Constructor Arguments (5:14​) DI Best Practices (7:59​)

Show lessShow more

9 Comments

Sort by
default-user=s48-c-k-c0x00ffffff-no-rj
Add a public comment...
Interesting video ! Is there some best practices to provide actor reference with DI mechanism also ?

2 months ago

Creating scope in a described way for long-living actors may cause some problems, especially when you're going to resolve sth like EF DbCotext and use it inside of an actor. Effectively for each message in a given actor, the same instance of DbCotext will be used. I'm not sure if this is the best idea. You can think about it as using DbContext registered as singleton in ASP.NET Core web app.

A few years ago I was trying to address the problem of resolving scoped dependencies in actors. This is what I came up with --> https://havret.io/akka-entity-framework-core

The article is slightly outdated but, the technique should be safer than the one presented in this video.

Read more 2 months ago


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK