Page 1 of 1

Is there any example on how to use Entity Developer Repository and UnitOf Work for .Net core 2.0?

Posted: Mon 27 Nov 2017 06:47
by RobertK
Is there any example on how to use Entity Developer Repository and UnitOf Work for .Net core 2.0?

Re: Is there any example on how to use Entity Developer Repository and UnitOf Work for .Net core 2.0?

Posted: Thu 30 Nov 2017 13:58
by Shalex
Just add the Repository and Unit Of Work template to your model.

The "Repository ..." template generates an intermediate code which works like an interface between your code and the model (EF Core in this case). Please check the generated classes and its methods, they are designed to simplify the usage of ORM model and supply the ability to switch to a different ORM preserving a workability of your code.

The simplest use case (added the Dept table to my EF Core model):

Code: Select all

    using (var context = new myEFCoreModel())
    {
        var deptRep = new DEPTRepository(context);
        var result = deptRep.GetAll();
    }
Documentation: http://www.devart.com/entitydeveloper/e ... eloper.chm (download, right click > Properties > Unblock), open it and navigate to ORM Support > Entity Framework Core > Generation > Model Generation Templates > Repository and Unit of Work Template.