Esempio n. 1
0
        internal static void SetAllPropertiesWithVerification(EntityDataSourceWrapper entityWrapper,
                                                              Dictionary <string, object> changedProperties,
                                                              bool overwrite)
        {
            Dictionary <string, Exception> exceptions = null;

            entityWrapper.SetAllProperties(changedProperties, /*overwriteSameValue*/ true, ref exceptions);

            if (null != exceptions)
            {
                // The EntityDataSourceValidationException has a property "InnerExceptions" that encapsulates
                // all of the failed property setters. The message from one of those errors is surfaced so that it
                // appears on the web page as a human-readable error like:
                //   "Error while setting property 'PropertyName': 'The value cannot be null.'."
                string key = exceptions.Keys.First();
                throw new EntityDataSourceValidationException(
                          Strings.EntityDataSourceView_DataConversionError(
                              key, exceptions[key].Message), exceptions);
            }
        }