Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

ASP.Net Core and dependency injection

$
0
0

just read this article http://www.c-sharpcorner.com/article/repository-pattern-in-asp-net-core/

from asp.net core we do not require 3rd part DI container to inject the dependency ?

see the below code

    public void ConfigureServices(IServiceCollection services)
            {
                services.AddMvc();
                services.AddDbContext<ApplicationContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
                services.AddTransient<IStudentRepository, StudentRepository>();
            }  

specially see this line services.AddTransient<IStudentRepository, StudentRepository>(); 

what are the package we need to install for the above mapping?

say before we use many DI like unity, ninject etc. what is the library name which people use for DI in asp.net core ?

how we can do this mapping in config file services.AddTransient<IStudentRepository, StudentRepository>(); ?

please answer my points.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>