Estoy intentando Ejecutar un programa para visualizar los datos de una base de datos en sql server, he hecho muchas cosas en cuanto a ellas usar el Swagger, ya que necesito JSON mas adelante, pero en fin, que tal ven el proyecto, y que me recomiendan, es mi primer proyecto y trabajo que me ponen en la empresa, muchas gracias
agradezco si me ayudan :/
I am trying to run a program to view the data from a database in SQL Server, I have done many things in terms of using Swagger, since I need JSON later, but anyway, how do you see the project, and what do you think? They recommend, it is my first project and job that they put me in the company, thank you very much
I appreciate if you help me :/
1条答案
按热度按时间yhuiod9q1#
Look into your program.cs file. There, you should have
Builder.Services.AddDbContext
.Since you're using Dependency Injection in your controller, you should add your
DbContext
to your application service collection.Note that your services could be added in other files, such as an Inversion of Control (IoC) own project.
Please take a look at this article: DbContext Lifetime, Configuration, and Initialization .