-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The best way to add injection #1
Comments
In my opinion, I prefer to put all the code in the "Code Behind" file. |
Do you inject in private or public properties?
|
in my case, all in private |
So, a best practice will be [Inject]
private IMemoryCache MemoryCache { get; set; } |
In my best practices, all attributes are above of the property/method... so, including [Inject] |
It's for this reason, I'm using a Factory pattern to include all service references into a Factory class. Factory class public virtual ProfileService Profiles => _profileService ?? (_profileService = new ProfileService(this));
public virtual AccountingService Accounting => _accountingService ?? (_accountingService = new AccountingService(this)); If the service is provided my Microsoft or external library, I inject the service directly to my component. |
I always wonder where to put my injections...
What is your opinion?
The text was updated successfully, but these errors were encountered: