Comments (8)
Hi, Thank you for the feedback.
I fixed this issue, can you confirm is this the behavior you expected?
e.g:
[Fact] // issue #27
public void ApplyFiltering_GreaterThanOrEqualBetweenTwoStrings()
{
var actual = _fakeRepository.AsQueryable().ApplyFiltering("name >= c" ).ToList();
var expected = _fakeRepository.Where(q => string.Compare(q.Name, "c", StringComparison.Ordinal ) >= 0 ).ToList();
Assert.Equal(expected.Count, actual.Count);
Assert.Equal(expected, actual);
Assert.True(actual.Any());
}
Also, it will be released in the next minor version.
from gridify.
Thanks. EF-Core doesn't like the third parameter here!
It translates
var res = query.Where(q => string.Compare(q.Name, "c") >= 0).ToList();
To:
SELECT [g].[Id], [g].[Name]
FROM [Genres] AS [g]
WHERE [g].[Name] >= N'c'
But it can't translate the query when StringComparison.xyz
is specified:
var res = query.Where(q => string.Compare(q.Name, "c", StringComparison.Ordinal) >= 0).ToList();
Result:
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: The LINQ expression 'DbSet<Genre>()
.Where(g => string.Compare(
strA: g.Name,
strB: "c",
comparisonType: Ordinal) >= 0)' could not be translated.
from gridify.
This feature is available in version v2.2.0
.
if you want to use this feature in SqlServer or MySql providers alongside with EntitiyFramework you should enable the compatibility layer from the Gridify.EntityFramework
package.
e.g
// You should use this configuration in your startup class or main method.
GridifyGlobalConfiguration.EnableEntityFrameworkCompatibilityLayer();
from gridify.
The translating to SQL query part is the problem. by default, we should always use the third parameter according to Microsoft documentation because Gridify is not limited to EntityFramework, but for compatibility, I'll probably add a global method EnableEntityFrameworkCompatibilityLayer
in the Gridify.EntityFramework
package to make underlying functions compatible to EntityFramework.
from gridify.
Thanks. Make this property public. Maybe someone just wants to use the original package.
from gridify.
Thanks. Make this property public. Maybe someone just wants to use the original package.
You're welcome., thank you for the feedback.
I really thought about this, there is nothing related to EntityFramework in the Gridify package, if I make this property public we really don't need the GridifyGlobalConfiguration class. I chose the harder way to keep the SoC. Also, if users using gridify alongside EF they should install the Gridify.EntityFramework
package in the first place. but To be honest I'm not really sure this is a good solution or not yet. what is your opinion? having EntityFramework related configuration in the gridify package doesn't violate the SoC?
from gridify.
Or you can just simply add it here:
var gQuery = new GridifyQuery()
{
// ...
IsEntityFrameworkCompatible = true
};
from gridify.
Thanks. Make this property public. Maybe someone just wants to use the original package.
Hi,
It is public now, check out the docs Here
Thanks for the feedback
from gridify.
Related Issues (20)
- Possibility to use Gridify (as parser) to create your own non-LINQ query builder HOT 2
- add support automatic mapping generation for child classes HOT 1
- Update documentation site dependencies (Vuepress2)
- Gridify.Elasticsearch generate DSL query (non-generic) HOT 3
- JavaScript client library HOT 3
- Creating an Abstractions Layer for Gridify
- Error "Specified method is not supported" when querying the Nested List field in Elasticsearch HOT 2
- DateTime Kind and PostgreSQL HOT 13
- IN style operator HOT 5
- Support for. NET8 HOT 4
- NativeAOT support
- Why library can not resolve IGridifyMapper<T> default in DbContext.ServiceProvider if exists HOT 1
- GRPC Support HOT 2
- Comparing data between two fields rather than using hardcoded values
- Cleanup dependencies HOT 2
- Filtering based on IDictionary values
- Passing filter value on CustomOperator Expression creation - for ContainsAny operator HOT 10
- Support automatic mapping generation for list of primitives
- Filtering for null/empty case insensitive HOT 3
- EntityFramework filtering with Many to Many case
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gridify.