Neoteroi / BlackSheep

Fast ASGI web framework for Python
https://www.neoteroi.dev/blacksheep/
MIT License
1.86k stars 78 forks source link

a mistake in tutorial #499

Open shabnamEsmaeili opened 3 months ago

shabnamEsmaeili commented 3 months ago

hi I am developing a server with blacksheep and it should have DI with singleton and some background job of the singleton classes. In your tutorial it is said that we can get the singleton object like this:

service = app.service_provider[Example]

but it comes with error that exception=AttributeError("'Application' object has no attribute 'service_provider'")

I came to an answer that it should be like this instead:

service = app.services.provider[Example]

https://www.neoteroi.dev/blacksheep/dependency-injection/#services-that-require-asynchronous-initialization