Hi Halil,
I saw your initial implementation of Aspects in Abp. That implementation is going to be continued? I would like to have a start point to create an aspect to intercept the DbEntityValidationException exceptions and send the errors messages to the SPA. What's is your recommendation for that? Thank you
5 Answer(s)
-
0
Hi,
No, I will not continue to Aspects in a short time. Maybe in the future. I created an article for AOP: <a class="postlink" href="http://www.codeproject.com/Articles/1080517/Aspect-Oriented-Programming-using-Interceptors-wit">http://www.codeproject.com/Articles/108 ... eptors-wit</a> You probably know it.
Here (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/0a875cfdbd3ec1d8d8a0d5dff20fb812f68b5f74/src/Abp.EntityFramework/EntityFramework/AbpDbContext.cs#L177">https://github.com/aspnetboilerplate/as ... xt.cs#L177</a>), we log validation errors but then throw the same exception. You can override SaveChanges, handle DbEntityValidationException and throw AbpValidationException since it's automatically sent to clients (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/62ef9634e5847c2cef42784619fdec545fb0d64c/src/Abp.Web/Web/Models/DefaultErrorInfoConverter.cs#L56">https://github.com/aspnetboilerplate/as ... ter.cs#L56</a>).
-
0
Thank you Halil!
-
0
Halil,
I've followed your article in code project. I've created an interceptor and is working perfectly. But now, i would like to localize some messages. How could i implement that? I've tried to inject the ILocalizationSource through the constructor, but didn't work. I receive that message:
'Abp.Localization.Sources.Resource.ResourceFileLocalizationSource' is waiting for the following dependencies:
- Parameter 'name' which was not provided. Did you forget to set the dependency?
- Service 'System.Resources.ResourceManager' which was not registered.
Thanks
-
0
Can you try to inject ILocalizationManager and use it instead of ILocalizationSource.
-
0
Thanks Halil!!