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

Class Library with Entity Framework Core

$
0
0

Hi,

Someone know where I can find any guide about how develop a Class Library Project with Entity Framework Core for .NET Core 2.0 or higger?

The problem is that when we develop an asp.net core mvc application, we add the context to the IServiceCollection on the ConfigureServices method. But on a Class Library Proyect we does not have a Startup.cs class to configure it, and so I don't know how approach that.

On a MVC application, Microsoft guides us to make that as following code, but, How can we make it on a Class Library without that class (startup.cs)?

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

Thanks a lot,

Regards!!!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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