Skip to content

2.x Upgrade Count() Issue #204

@tynorton

Description

@tynorton

I just tried upgrading our SharpRepository packages to 2.x and ran into an exception.

I traced it down to SharpRepositoryBase.Count(ISpecification<T> criteria).

image

Compare that Count(ISpecification<T> criteria) to 1.5.0.2's: https://github.com/SharpRepository/SharpRepository/blob/1.5.0.2/SharpRepository.Repository/RepositoryBase.cs#L826

So at some point all of the Expression<>s were compiled into Func<>s. I wondered why.

So, I tracked down the change in question: 8c1f9aa#diff-d24380b902ea13a619155432be3b7b18R841

Looks like this was done as part of a change to handle differences in NETSTANDARD vs NETFX reflection/types.

But, in our case, broke what was working.

Is that Compile() necessary? If not we should probably revert to the old method which doesn't throw (See below where predicate is the Func<>).

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions