Esempio n. 1
0
 /// <summary>
 /// Validates that the keys in the update parameters all match property names on the entityWrapper.
 /// </summary>
 /// <param name="entityWrapper"></param>
 /// <param name="parameters"></param>
 internal static void ValidateWebControlParameterNames(EntityDataSourceWrapper entityWrapper,
                                                       ParameterCollection parameters,
                                                       EntityDataSource owner)
 {
     Debug.Assert(null != entityWrapper, "entityWrapper should not be null");
     if (null != parameters)
     {
         PropertyDescriptorCollection entityProperties = entityWrapper.GetProperties();
         System.Collections.Specialized.IOrderedDictionary parmVals = parameters.GetValues(owner.HttpContext, owner);
         foreach (DictionaryEntry de in parmVals)
         {
             string key = de.Key as string;
             if (null == key || null == entityProperties.Find(key, false))
             {
                 throw new InvalidOperationException(Strings.EntityDataSourceUtil_InsertUpdateParametersDontMatchPropertyNameOnEntity(key, entityWrapper.WrappedEntity.GetType().ToString()));
             }
         }
     }
 }