Comments (6)
Here is a simple solution. In the console app I execute one method from RecipientService twice. Please specify your connection string or change to what you need in OMS.Entity -> Context -> OMSContext file and update a db with Initial migration.
from gridify.
This error is related to the Entity Framework Service Provider Caching system. I will investigate more on this to find out why this is happening and what is the best way to handle similar cases. Until then you can disable service provider caching.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
//optionsBuilder.UseInMemoryDatabase("mydb");
optionsBuilder.EnableServiceProviderCaching(false);
}
from gridify.
@vklymchuk
I've added EntityFramework ServiceProviderCaching support to Gridify. you can use this feature in the next release. (1.3.2)
thank you.
from gridify.
Hello
your first problem is not clear because you can use a field name multiple times.
you need to provide more information to help reproduce the problem.
[Fact]
public void ApplyFiltering_DuplicateFiledName()
{
var gq = new GridifyQuery {Filter = "name==John|name==Sara"};
var actual = _fakeRepository.AsQueryable()
.ApplyFiltering(gq)
.ToList();
var expected = _fakeRepository.Where(q => q.Name == "John" | q.Name == "Sara").ToList();
Assert.Equal(expected.Count, actual.Count);
Assert.Equal(expected, actual);
Assert.True(actual.Any());
}
there is no problem with duplicate field names.
but about your second question about null:
by default, Gridify does not have any magic string
to handle null strings yet but you can define it if you need.
you need to create a custom mapping (GridifyMapper) and implement your own null handling.
e.g look at this test:
[Fact]
public void ApplyFiltering_NullQuery()
{
// create custom mapper
var gm = new GridifyMapper<TestClass>().GenerateMappings();
// map any string to related property , also use Client convertor to handle custom scenarios
gm.AddMap("date", g => g.MyDateTime, q => q == "null" ? null : q);
var gq = new GridifyQuery {Filter = "date==null"};
var actual = _fakeRepository.AsQueryable()
.ApplyFiltering(gq, gm)
.ToList();
var expected = _fakeRepository.Where(q => q.MyDateTime == null).ToList();
Assert.Equal(expected.Count, actual.Count);
Assert.Equal(expected, actual);
Assert.True(actual.Any());
}
from gridify.
you need to create a custom mapping (GridifyMapper) and implement your own null handling.
Thanks, implemented.
you need to provide more information to help reproduce the problem.
Try to repeat filtering with the same filter query please. I noticed it'd occured when I send one request to api twice or more.
from gridify.
your welcome.
I think your problem is not related to Gridify because internally Gridify is not using any Dictionary at all.
look at the second line of your error message:
System.ArgumentException: An item with the same key has already been added. Key: Param_0
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
it can not add some Keys to some dictionary... I'm 90 percent sure it is not a Gridify problem because I can't find any errors in my tests.
but try to create a small repo to reproduce the problem, I will check.
from gridify.
Related Issues (20)
- 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
- Concurrently changing GridifyGlobalConfigurations causes inconsistent behavior
- Add support generating conditions with Index or Key in gridify-client
- DateTime Kind and Postgres HOT 4
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.