Esempio n. 1
0
 private bool TryGetAllRecords(string clazz, out Response<Object> response)
 {
     response = new Response<object>();
     if (_proxy.db.Tables.Keys.Contains(clazz.ToLower()))
     {
         fakeUnknown fu = new fakeUnknown(clazz, _proxy);
         response = fu.get_all_records();
         return true;
     }
     return false;
 }
Esempio n. 2
0
        public object ExecuteMethod(ProxyMethodInfo pmi, object[] args)
        {
            object obj;

            if (pmi.FakeType == typeof(fakeUnknown))
            {
                obj = new fakeUnknown(pmi.TypeName, this);
            }
            else
            {
                obj = Activator.CreateInstance(pmi.FakeType, this);
            }

            object[] methodArgs = new object[pmi.FakeMethod.GetParameters().Length];
            for (int i = 0; i < methodArgs.Length; i++)
            {
                methodArgs[i] = args[i];
            }

            switch (pmi.FakeMethodType)
            {
                case MethodType.Sync:
                    return pmi.FakeMethod.Invoke(obj, methodArgs);

                case MethodType.Async:
                    Response<string> response = (Response<string>)pmi.FakeMethod.Invoke(obj, methodArgs);
                    if (response.Status == ResponseTypes.SUCCESS)
                    {
                        return new Response<string>(CreateTask(DbProxy.TaskStatus.success, response.Value));
                    }
                    else
                    {
                        return new Response<string>(CreateTask(DbProxy.TaskStatus.failure, response.ErrorDescription));
                    }

            }

            return new Response<String>(true, new String[] { Failure.INTERNAL_ERROR });
        }