While debugging of LightSwitch apps I get from time to time strange note about failed query that is in the plumbing of every LighSwitch app. App will hang with note in the middle of screen like this :
Only thing that you can do as developer is : Build > Clean Solution and re-run app. Or just re-run it, but then it may hang like this :
Really strange behavior. Anyway clean works so happy debugging :)
Adding custom validation is quite easy task, but currently Microsoft has problem with not updated MSDN article http://msdn.microsoft.com/en-us/library/ff852045.aspx. I just would like to tell you that code snippet on this MSDN page is not working.
This is correct snippet (this code is placed in SomeEntity_Validate event on server) :
if (entity.SomeBoolProperty == true)
results.AddPropertyError(“Text with error for user.”, entity.Details.Properties.SomePropertyToBindErrorTo);
results.AddEntityError(“Text with error for whole property”);
This way you will see error generated from first row of code as your custom error text from first parameter followed by property name. Second row will generate error with name of property followed by your custom text. Errors could look like this :
Please note that this code is fired on server and thus you need to create roundtrip (error will show up when Save was pressed, not on client when filling properties like required fields and so on).
OK, takže dnes som zdá sa po menších problémoch úspešne presunul tento blog na WP, nechám sa prekvapiť ako sa mi s ním bude “spolupracovať”.
Želám Vám všetkým pekné sviatky :)