umbraco / Umbraco.UIBuilder.Issues

Back office UI builder for Umbraco
3 stars 2 forks source link

Make whereClause nullable in custom repo overrides #75

Closed jemayn closed 8 months ago

jemayn commented 10 months ago

Describe the bug If I create my own repo for the data in UI Builder then it will generate the methods to override for me via the IDE.

However, some of them has an expression parameter for a whereClause:

protected override IEnumerable<Movie> GetAllImpl(Expression<Func<Movie, bool>> whereClause, Expression<Func<Movie, object>> orderBy, SortDirection orderByDirection)
{
    throw new NotImplementedException();
}

protected override PagedResult<Movie> GetPagedImpl(int pageNumber, int pageSize, Expression<Func<Movie, bool>> whereClause, Expression<Func<Movie, object>> orderBy,
    SortDirection orderByDirection)
{
    throw new NotImplementedException();
}

protected override long GetCountImpl(Expression<Func<Movie, bool>> whereClause)
{
    throw new NotImplementedException();
}

And if no filters or anything is added then the whereClause is null, which means we need to have a nullcheck for it, but our IDE will constantly tell us that the null check is not needed:

image

image

Would be nice if the method set the Expression as nullable.

Environment (please complete the following information):

acoumb commented 8 months ago

Hi @jemayn ,

We have addressed this with the latest major release of Umbraco.UIBuilder.

Regards, Adrian