This article is a mirror article of machine translation, please click here to jump to the original article.

View: 48955|Reply: 9

[ASP.NET] Dependent on the use of injected Autofac

[Copy link]
Posted on 2/28/2019 10:26:17 PM | | | |
This one that the previous company came into contact with, it is not very in-depth, write here to record, if it is wrong, please correct it


First, create an MVC project and add Autofac directly via Nuget.


Autofac   4.9.1
Autofac.Mvc5   4.0.2




Create a library project
Add IService.cs to locate the one you want to registerService assembly

Add MessageService.cs, UserService.cs, as a service that needs to be injected



Add ServiceLocator.cs to the web project to obtain the specified service to be injected


Include the registration code for dependency injection in Global.asax


There are two methods that can be used to get the injected service


Source:The hyperlink login is visible.  Extraction code:
Tourists, if you want to see the hidden content of this post, pleaseReply










Previous:The basic operations of the table on the basis of the database
Next:I want to program with E4A, but some people say that the compatibility is very poor, and many phones do not ..... after development
Posted on 3/2/2019 6:22:17 PM |
Let's take a look.
Posted on 4/9/2019 3:28:07 PM |
You don't have to create your own new object
Posted on 5/10/2019 1:44:43 PM |
Yes, I learned
Posted on 5/20/2019 4:43:06 PM |
1111111111111111111
Posted on 7/11/2019 9:11:11 AM |
1111111111
Posted on 8/28/2019 11:07:55 PM |
1111
Posted on 11/26/2019 11:02:49 AM |
Check out the trouble
Posted on 12/3/2019 1:46:38 PM |
Learn it
Posted on 11/2/2020 4:57:28 PM |
Not bad, I'll download it and take a look, etc
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com