Manish Patel
Manish Patel

Reputation: 11

SharpRepository EfCoreRepository Initialization in .net Core

I need help in initializing SharpRepository in .net Core? How do I use dbcontext with SharpRepository? Where in startup can I put initialization code?

I am using Entityframeworkcore with sql server

https://github.com/SharpRepository/SharpRepository

Please post if you have sample code

Thank you

Upvotes: 1

Views: 503

Answers (1)

fiorebat
fiorebat

Reputation: 3451

now EfCore repository is stable!

You need to setup DbContext at the same way microsoft suggest

services.AddDbContext<ContactContext>(options =>
                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

in ConfigureServices inside Statup.cs

you can find a setup guide https://github.com/SharpRepository/SharpRepository/wiki/Getting-started

a full .net core mvc project sample is here: https://github.com/SharpRepository/SharpRepository/tree/develop/SharpRepository.Samples.CoreMvc

Regards

Upvotes: 0

Related Questions