-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity Framework Validation errors not being handled correctly by breeze.sharp client. #3
Comments
Hi chrismon, Can you please samples breeze.sharp using SPA(single page applications). Samples |
Hello, yes I have reviewed samples and am working with an Angular application as well at the moment without issues. The issue I ran into with this post was while communicating with my Breeze service from a new Breeze.Sharp .Net client I am working on. If there is something I am doing wrong in the service that you think the samples would help me understand, could you please expand on that? |
Hi chrismon, I know chirsmon you expected breeze.sharp worked many project . But I am beginner of the breeze.sharp. How do i used breeze.sharp i don't know. So can you help little examples. Please |
ponmani, please do not use github to ask for examples. It is for reporting bugs only. StackOverflow is the place for questions. Also, you have some confusion about breeze.sharp. Breeze.sharp is a client-side framework that runs in the .NET platform. If you were writing a desktop application using Windows Forms or WPF, or a Windows 8 application, you would use breeze.sharp. If you want to use HTML and JavaScript, you would use breeze.js on the client. There are plenty of samples and tutorials using breeze.js. If you are using ASP.NET on the server, you would use breeze.server.net. It works with Entity Framework and NHibernate to make it easy to write a backend for your breeze.js or breeze.sharp client. If you have any further questions, please ask them on StackOverflow |
Oh. Thank u. Yes I already confused breeze.sharp is server side framework. On Fri, Jun 6, 2014 at 2:13 AM, Steve Schmitt [email protected]
|
I already used breeze.js an breeze controller in durandal framework. On Fri, Jun 6, 2014 at 9:35 AM, Pon Mani [email protected] wrote:
|
Hi steveschmitt, I can't undertsand breeze.js and breeze.sharp.But I know that breeze.js and breeze controller using single page application. Can you explain breeze.sharp topic with your simple examples. |
Hi ponmani, |
This issue is in the 0.5.4 release of Breeze.Sharp. Not sure if it should be fixed in Breeze.Sharp or perhaps Breeze.ContextProvider.EF6, but there seems to be a disconnect between expected behaviors.
Unexpected Behavior:
I have a .Net Web API BreezeController that contains an EF6 repository.
If I perform object level validation via BeforeSaveEntities override, where the guidance is to fail validation by throwing an EntityErrorsException, the Breeze.Sharp client catches this as expected and all is well.
If, however, I perform attribute level validation using an Entity Framework ValidationAttribute class, instead of an EntityErrorsException, failures are returned to the Breeze.Sharp client as a SaveResult containing an Errors collection. In this case, the client throws an exception: Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'. This exception occurs when Breeze.Sharp tries to parse the SaveResult's KeyMappings array, which is null.
Workaround:
For now, rather than changing all of my Validation Attributes to throw an EntityErrorsException, I resolved this in my BreezeController's SaveChanges method by checking the returning SaveResults for any errors, and if found, wrapping those errors in an exception that I then throw to the client:
The text was updated successfully, but these errors were encountered: