Skip to content

Extra overloading Fetch methods using AsNoTracking()  #11

Closed
@jersiovic

Description

What do you think of offering extra overloads for Fetch methods that use AsNoTracking in order to improve performance?

    public virtual IQueryable<T> FetchWithNoTracking(Expression<Func<T, bool>> predicate)
    {
        return Table.AsNoTracking().Where(predicate);
    }

Indeed in order to help devs to don't forget to use the most most optimal one I would use:

public virtual IQueryable<T> Fetch(Expression<Func<T, bool>> predicate)
        {
            return Table.AsNoTracking().Where(predicate);
        }

public virtual IQueryable<T> FetchWithTracking(Expression<Func<T, bool>> predicate) {
            return Table.Where(predicate);
        }

Problem is it is a breaking change, so to avoid unnoticed bad uses of the Fech method maybe it will be better to remove Fech method and only have FetchWithTracking and FetchWithNoTracking methods.

What do you think?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions