dimanche 7 avril 2019

Create 3 Tier Architecture In DotNet Core 2.2 Web API C#

I am working on Web API Core 2.2 and need to design 3 tier architecture. How can I do it.

My Project Structure as below

enter image description here

In Web API Project..

public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext<HrmsDbContext>(opt =>
              opt.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
}

In DAL (Library project, I have made my DBContext and provided connectionstring like below.

enter image description here

Is there any better so that I had not provide connectionstring at two places? and write 3 tier architecture in good way.

Any help will be appreciated.

Aucun commentaire:

Enregistrer un commentaire