EasyRepository.EFCore icon indicating copy to clipboard operation
EasyRepository.EFCore copied to clipboard

File scoped and explicit enums

Open jeffward01 opened this issue 3 years ago • 3 comments

Summary

*** Summary is here ***

Changes made:

  • Changed all files to 'file-scoped' namespaces
  • Resharper automatically formatted the namespaces and using statements
  • Added methods for Enum version of boolean as no tracking
  • Added Obsolete messages
  • Changed a typo of async Task<int> Count(....) to async Task<int> CountAsync(....)
  • Changed the Enum version of the method:
  • Changed only the enum version of the method GetById to use the AsNoTracking option. See below

    public TEntity GetById<TEntity>(bool asNoTracking, object id)
        where TEntity : class
    {
        return this._context.Set<TEntity>()
            .FirstOrDefault(this.GenerateExpression<TEntity>(id));
    }

    /// <inheritdoc />
    public TEntity GetById<TEntity>(EfTrackingOptions asNoTracking, object id)
        where TEntity : class
    {
        var queryable = this.FindQueryable<TEntity>(asNoTracking)
            .FirstOrDefault(this.GenerateExpression<TEntity>(id));

        return queryable;
    }

image

If you want, I can also apply the change to the classic boolean GetById<TEntity>(bool, object) method. I did not want to introduce any breaking changes, so I skipped this on the classic version.

jeffward01 avatar Oct 01 '22 03:10 jeffward01

Let the methods using normal bools stay for now. I don't think it's necessary to make a big change in one go. We will remove it in future versions. @jeffward01

furkandeveloper avatar Oct 01 '22 11:10 furkandeveloper

First of all, big thank you for all of your change requests! I would much rather that you mention your opinion and suggest changes, rather than 'just hit accept'. Thank you.

Let the methods using normal bools stay for now. I don't think it's necessary to make a big change in one go. We will remove it in future versions. @jeffward01

Are the [Obsolete] attributes I added alright?

Remove unnecessary 'this' qualifier

Ahh, your one of these people who dislike this. ❤️ || I understand why people dislike them, I also understand why people like them. No issue at all!

I will remove all of this. keywords AND make an .editorconfig file that is .sln scoped for the library so that the coding standards could be maintained. Please give me a few days to do this

jeffward01 avatar Oct 01 '22 18:10 jeffward01

First of all, big thank you for all of your change requests! I would much rather that you mention your opinion and suggest changes, rather than 'just hit accept'. Thank you.

Let the methods using normal bools stay for now. I don't think it's necessary to make a big change in one go. We will remove it in future versions. @jeffward01

Are the [Obsolete] attributes I added alright?

Remove unnecessary 'this' qualifier

Ahh, your one of these people who dislike this. ❤️ || I understand why people dislike them, I also understand why people like them. No issue at all!

I will remove all of this. keywords AND make an .editorconfig file that is .sln scoped for the library so that the coding standards could be maintained. Please give me a few days to do this

You are right, with .editorconfig these problems can be avoided. We are waiting for you. :D

furkandeveloper avatar Oct 01 '22 19:10 furkandeveloper