shung
@shung
Reviews Written
15
Average Rating
5.0
Posts
Q&A
Unable to create an object of type 'ApplicationDbContext'
using Microsoft.EntityFrameworkCore; using WebApi.Data; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorPages(); // .NET Core ์ต์ ๋ฒ์ ์ฉ AddDbContext ๋ฐฉ๋ฒ. builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.MapRazorPages(); app.Run();.NET Core์ ์ต์ ๋ฒ์ ์์๋ Startup์ด ๋์ด์ ์ฌ์ฉ๋์ง ์์์ ๋ง์ํ์ ๋๋ก Program.cs์ ๋ค์๊ณผ ๊ฐ์ด ์ ๋ ฅํ์ฌ ์ฒ๋ฆฌํ๋ฉด ๋ฉ๋๋ค.์์๊ณผ ๋๊ฐ์ด ํ์ จ๋๋ผ๋ฉด, ์๋จ์ using์ ๋ค์๊ณผ ๊ฐ์ด ์์ฑํด์ฃผ์๋ฉด ๋ฉ๋๋ค. using Microsoft.EntityFrameworkCore; using WebApi.Data;์ด ํ UsesSqlServer๊ฐ ๋ ๋ง์ฝ์ผํ ๋ฐ ์ด๋ ๊ฐ์์์ ๋ณด์ ๊ฒ์ฒ๋ผ Microsoft.EntityFrameworkCore.sqlserver ์ค์นํ๋ฉด ๋ฌธ์ ์์ด ์งํ๋ฉ๋๋ค~!
- 0
- 2
- 649
Q&A
CalcPathFromParent ์์ ์๋ฌ๊ฐ ๋ฉ๋๋ค.
๋ฌธ์ ์ ๊น์ง ์ด๋ ๊ฒ ์น์ ํ๊ฒ ์๋ ค์ฃผ์ จ์ผ๋ ์ ๊ฐ ๊ผญ ํด๊ฒฐํด๋ณด๊ฒ ์ต๋๋ค! ๊ฐ์ฌํฉ๋๋ค!
- 0
- 2
- 329
Q&A
Program์์ ํ๋ ์ด์ด๋ฅผ ๋ถ๋ฌ์ค์ง ๋ชปํฉ๋๋ค.
์ ์ ์๋~ ๋๊ธ ์ฌ๋ ค์ฃผ์๊ธฐ ์ ์ ๋ฌธ์ ์ ์ ํ์ธํด์ ์์ ํด๋ณด๋ ์ ๋๊ณ ์์ต๋๋ค. ์ฃผ๋ง์ ์ฌ๊ณ ๊ณ์๋๋ฐ ๋ฒ๊ฑฐ๋กญ๊ฒ ํด์ ์ฃ์กํฉ๋๋ค :) ๊ฐ์ฌํฉ๋๋ค!
- 0
- 2
- 461




