Closed plemm98 closed 4 years ago
Hello @plemm98 ,
I believe you are looking for the SetFilterScopedParameterValue
You will be able to set it in your context constructor.
See some examples:
Let me know if that helped you to find your solution.
Best Regards,
Jon
Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework Extensions • Entity Framework Classic • Bulk Operations • Dapper Plus
Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval Function • SQL Eval Function
Description
Let's say I need to filter a table that contains a column call "clientid". I got a DBContext file that look like this :
As you can see, i'm passing the clientId that need to be use in the filter condition directly in the constructor of my dbcontext. Then, I set the value to the property of my dbcontext. Finally, i'm using this property in my dynamic filter.
When I execute this line of code in my program.cs, the value of "clientid" get set properly the first time the model is actually call, but the second time, it's still using the first value. It's like the dbcontext is cache, and i cannot change it's value.
So, my understanding, is that I cannot store the client id that i want to use directly in the constructor of my dbcontext. It's seem the filter process will use the one in the cache and keep using the first client id I input the first time the model was invoke for eternity. Or, until i close my application.
Where is the best place to store the clientid, to make sure the dynamic filter will pick up the appropriate value when it execute? This value will change quite often during the execution of a single method.
Best regards,
EF 6.4.0 Latest version of dynamic filters.