Breeze / breeze.server.net

Breeze support for .NET servers
MIT License
76 stars 62 forks source link

EFContextProvider .Net Core 3.1 #91

Closed softronsts closed 4 years ago

softronsts commented 4 years ago

I am trying to adopt Rep/UoW patterns from temp-hire source. In .net core, EFContextProvider requires two params, Could you please advise what configuration need to passed to the second argument?

using Breeze.ContextProvider; using Breeze.ContextProvider.EFCore; using Breeze.Persistence.EFCore; using Microsoft.Extensions.Configuration; using Newtonsoft.Json.Linq; using VLMS.Data.Models;

namespace Project.Data.Services { public class UnitOfWork { private readonly EFContextProvider _contextProvider;

    public UnitOfWork()
    {
        ApplicationDbContext _context = new ApplicationDbContext();

        IConfiguration configuration;
        ConfigurationBuilder builder = new ConfigurationBuilder();

        configuration = builder.Build();

        _contextProvider = new EFContextProvider<ApplicationDbContext>(_context, configuration);
steveschmitt commented 4 years ago

You should be using Breeze.Persistence.EFCore.EFPersistenceManager instead of EFContextProvider. In .NET Core, you shouldn't have any Breeze.ContextProvider packages.

There's an example Core 3.1 project in the northwind-core-ng-demo repo, as well as a step-by-step guide for starting from scratch.

That is a minimal sample and doesn't use Rep/UoW patterns, so you'll still need to refer back to TempHire for the architecture.

softronsts commented 4 years ago

Thank you for your timely response.