Comments (2)
Hi @djoyrocks,
There isn't anything in GenericServices at the moment that could handle that. I will think about it (maybe something that runs before the call to SaveChanges), but I am very busy at the moment so its not going to get done quickly.
If you need a solution quickly I can think of a way to do this, but its not that nice. You could override the SaveChanges/SaveChangesAsync in your DbContext and run your fluentvalidation tests in there. If there is a validation failure you then throw an exception with the validation errors in that exception. Then you provide a SQL error handler via the configuration in which you look for your validation exception and turn the errors in that exception into a IStatusGeneric
state to fit in with GenircServices. Bit of a kludge, but it would work.
Note: You need to turn on the normal validation, otherwise the SQL error handler isn't used. This means the standard validation is run before your fluentvalidation is run.
I'll keep this open for when I get time to look at this.
from efcore.genericservices.
Hi @djoyrocks,
I have created a preview version of EfCore.GenericServices 2.0.0-preview001 which contains code that allows you to inject your fluentvalidation prior to calling SaveChanges. Have a look and see if it works for you and let me know. Then I will release it.
from efcore.genericservices.
Related Issues (20)
- QueryTrackingBehavior.NoTracking and Updates HOT 2
- Scanning DTOs in Assembly with Multiple Contexts Fails HOT 5
- Object not set to an instance of an object HOT 15
- GenericServiceErrorHandler not exist HOT 1
- GenericService throws an error sometimes while using UpdateAndSaveAsync with method name HOT 3
- Question: Why is the DbContext initialized during registration HOT 4
- How to replace a row in many to many relationship using generic services? HOT 1
- EF Core 5.0 Many-To-Many relationships not working HOT 3
- InvalidOperationException when saving an object that contains two properties that refer to the same object. HOT 1
- ICrudServices for updating soft delete property using query filters HOT 2
- ArgumentException: Type 'ObserVisionWeb.PaginatedList`1[MyDto]' does not have a default constructor (Parameter 'type') HOT 3
- Conflict with AutoMapper v10.1.1, Throws Exception HOT 13
- Issues using with Blazor Server HOT 9
- Not sure if issue or working as intended HOT 2
- of type 'System.DBNull' to type 'System.DateTime' HOT 1
- SetupEntitiesDirect fails if one uses records in the entities HOT 6
- Not compatible with Automapper 11.0.0 HOT 7
- Causes application crash when used with Serilog bootstrap logger. HOT 2
- How do you configure an AutoMapper IGlobalFeature? HOT 6
- .NET 7 released
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 efcore.genericservices.