Skip to content

Releases: lonesomegeek/LSG.GenericCrud

Version 3.0.0

14 Feb 22:33
a75744f
Compare
Choose a tag to compare

Release Notes - v3.0

  • LSG.GenericCrud
    • Switch from an inheritance model (controllers, services) to a composition model
    • Async classes have been removed and all base code is now async by default (controllers, services, repositories)
  • LSG.GenericCrud.Extensions
    • Adding IReadeableCrud*, to let have user info about new stuff in entities dynamically more documentation will come soon
    • Implement data filler async functions
  • Samples
    • Remove Async Sample (because base classes are async now)
    • Remove Async versions in all samples (because base classes are async now)
    • Adding new applicatino sample in development, not ready yet
    • Update all samples to manage new architecture
  • Tests
    • Update all tests to manage new architecture

v3.0 new architecture

The simpliest way to explain the changes of the new version is to compare them side by side. If you need more complete samples, take a look at the samples.

You may say that the new version needs a little more code, but is way more flexible. And... let's say that a little copy/paste can't hurt that much! :)

Idem (inheritance) from v2.0 CrudController<T> and v3.0

To make things simple, I've supported the inheritance for the simpliest CRUD scenario through CrudController<T> in the v3.0.

Before (v2.*)

[Route("api/[controller]")]
public class AccountsController : CrudController<Account>
{
    public AccountsController(ICrudService<Account> service) : base(service)
    {
    }
}

After (v3.*)

[Route("api/[controller]")]
public class AccountsController : CrudController<Account>
{
    public AccountsController(ICrudService<Account> service) : base(service)
    {
    }
}

Composition with CrudController<T>

CrudController<T> with composition.

Before (v2.*)

[Route("api/[controller]")]
public class AccountsController : CrudController<Account>
{
    public AccountsController(ICrudService<Account> service) : base(service)
    {
    }
}

After (v3.*)

[Route("api/[controller]")]
[ApiController]
public class AccountsController :
    ControllerBase,
    ICrudController<Account>
{
    private readonly ICrudController<Account> _controller;

    public AccountsController(ICrudController<Account> controller)
    {
        _controller = controller;
    }

    [HttpPost]
    public async Task<ActionResult<Account>> Create([FromBody] Account entity) => await _controller.Create(entity);
    [HttpDelete("{id}")]
    public async Task<ActionResult<Account>> Delete(Guid id) => await _controller.Delete(id);
    [HttpGet]
    public async Task<ActionResult<IEnumerable<Account>>> GetAll() => await _controller.GetAll();
    [Route("{id}")]
    [HttpGet]
    public async Task<ActionResult<Account>> GetById(Guid id) => await _controller.GetById(id);
    [HttpPut("{id}")]
    public async Task<IActionResult> Update(Guid id, [FromBody] Account entity) => await _controller.Update(id, entity);
}

Composition with HistoricalCrudController<T>

HistoricalCrudController<T> with composition.

Before (v2.*)

[Route("api/[controller]")]
public class AccountsController : HistoricalCrudController<Account>
{
    public AccountsController(IHistoricalCrudService<Account> service) : base(service)
    {
    }
}

After (v3.*)

[Route("api/[controller]")]
[ApiController]
public class AccountsController :
    ControllerBase,
    ICrudController<Account>,
    IHistoricalCrudController<Account>
{
    private readonly IHistoricalCrudController<Account> _controller;

    public AccountsController(IHistoricalCrudController<Account> controller)
    {
        _controller = controller;
    }

    [HttpPost]
    public async Task<ActionResult<Account>> Create([FromBody] Account entity) => await _controller.Create(entity);
    [HttpDelete("{id}")]
    public async Task<ActionResult<Account>> Delete(Guid id) => await _controller.Delete(id);
    [HttpGet]
    public async Task<ActionResult<IEnumerable<Account>>> GetAll() => await _controller.GetAll();
    [Route("{id}")]
    [HttpGet]
    public async Task<ActionResult<Account>> GetById(Guid id) => await _controller.GetById(id);
    [HttpPut("{id}")]
    public async Task<IActionResult> Update(Guid id, [FromBody] Account entity) => await _controller.Update(id, entity);
    [HttpGet("{id}/history")]
    public async Task<IActionResult> GetHistory(Guid id) => await _controller.GetHistory(id);
    [HttpPost("{id}/restore")]
    public async Task<IActionResult> Restore(Guid id) => await _controller.Restore(id);
}

Version 2.1.1

24 Dec 18:19
Compare
Choose a tag to compare

In this release, I've added:

  • support for .NET Standard 2.0
  • simplified configuration in Startup.cs

You can take a look at the Readme file and check the updated samples.
Enjoy!

Milestone fixed issues: https://github.com/lonesomegeek/LSG.GenericCrud/milestone/5?closed=1

Version 2.0.0

10 Nov 17:17
Compare
Choose a tag to compare

Version 1.4.0

05 Oct 23:15
Compare
Choose a tag to compare

In this release, I split all the DTO and Extensions logic to separate libraries to keep the principal library as lightweight as possible:

  • All CrudController<TDto, TEntity> stuff is now located in a new nuget library: LSG.GenericCrud.Dto
  • There was data fillers and middlewares designed in a pre 1.* version that I removed and placed to its own extension library: LSG.GenericCrud.Extensions

Documentation and samples has been updated accordingly

Version 1.3.0

02 Oct 23:59
Compare
Choose a tag to compare

In this version, I've added these features:

  • Unit test coverage of controllers and repositories
  • Remove DataFillers from principal library and create an extension library
  • Do some cleanup in namespaces

With relocation and creation of new library, the code itself did not change in this version. It is why it is not a breaking changes with a new major version.

  • Namespace relocation of:
    • LSG.GenericCrud.Repositories.DataFillers to LSG.GenericCrud.Extensions.DataFillers
    • LSG.GenericCrud.Middlewares to LSG.GenericCrud.Extensions.Middlewares

Version 1.2.0

23 Sep 17:44
Compare
Choose a tag to compare

#33 Support for async operations

Stable version

20 Sep 23:27
Compare
Choose a tag to compare
Bug/28 (#34) (#35)

* bug resolved with unit tests

* bug #28 et #30 resolved

* bug #28 et #30 resolved