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

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
RobertK
Posts: 56
Joined: Thu 02 Mar 2017 05:44

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

Post by RobertK » Mon 27 Nov 2017 06:47

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

Shalex
Site Admin
Posts: 8239
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Thu 30 Nov 2017 13:58

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.

Post Reply