Exemple #1
0
 ///<summary></summary>
 public static SerializableDictionary <K, V> GetSerializableDictionary <K, V>(MethodBase methodBase, params object[] parameters)
 {
     if (RemotingClient.RemotingRole != RemotingRole.ClientWeb)
     {
         throw new ApplicationException("Meth.GetSerializableDictionary may only be used when RemotingRole is ClientWeb.");
     }
                 #if DEBUG
     //Verify that it returns a DataTable
     MethodInfo methodInfo = null;
     try {
         methodInfo = methodBase.ReflectedType.GetMethod(methodBase.Name);
     }
     catch (AmbiguousMatchException) {
         //Ambiguous match exceptions do not matter for the middle tier and are just annoying when they get thrown here.  Ignore them.
     }
     if (methodInfo != null && methodInfo.ReturnType != typeof(SerializableDictionary <K, V>))
     {
         throw new ApplicationException("Meth.GetSerializableDictionary calling class must return SerializableDictionary.");
     }
                 #endif
     DtoGetSerializableDictionary dto = new DtoGetSerializableDictionary();
     dto.MethodName = methodBase.DeclaringType.Namespace + "."
                      + methodBase.DeclaringType.Name + "." + methodBase.Name;
     dto.Params               = DtoObject.ConstructArray(methodBase, parameters);
     dto.Credentials          = new Credentials();
     dto.Credentials.Username = Security.CurUser.UserName;
     dto.Credentials.Password = Security.PasswordTyped;          //.CurUser.Password;
     dto.ComputerName         = Security.CurComputerName;
     SerializableDictionary <K, V> retval = new SerializableDictionary <K, V>();
     try {
         retval = RemotingClient.ProcessGetSerializableDictionary <K, V>(dto);
     }
     catch (ODException ex) {
         if (ex.ErrorCode == (int)ODException.ErrorCodes.CheckUserAndPasswordFailed)
         {
             CredentialsFailed();                    //The application pauses here in the main thread to wait for user input.
             retval = GetSerializableDictionary <K, V>(methodBase, parameters);
         }
         else
         {
             throw;
         }
     }
     return(retval);
 }