File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,6 @@ public Startup(IConfiguration configuration)
30
30
// This method gets called by the runtime. Use this method to add services to the container.
31
31
public void ConfigureServices ( IServiceCollection services )
32
32
{
33
- services . AddDbContext < MyDbContext > ( opt => opt . UseSqlServer
34
- ( Configuration . GetConnectionString ( "CommanderConnection" ) ) ) ;
35
-
36
33
services . AddControllers ( ) ;
37
34
services . AddSwaggerGen ( c =>
38
35
{
@@ -41,8 +38,13 @@ public void ConfigureServices(IServiceCollection services)
41
38
42
39
services . AddAutoMapper ( AppDomain . CurrentDomain . GetAssemblies ( ) ) ;
43
40
41
+ // From -> Into (dependency injection)
42
+
44
43
//services.AddScoped<ICommanderRepository, CommanderRepository>();
45
44
services . AddScoped < ICommanderRepository , SqlCommanderRepository > ( ) ;
45
+
46
+ services . AddDbContext < MyDbContext > ( opt => opt . UseSqlServer
47
+ ( Configuration . GetConnectionString ( "CommanderConnection" ) ) ) ;
46
48
}
47
49
48
50
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
You can’t perform that action at this time.
0 commit comments