public static bool Try(DextopApiController controller, String action, out IDextopApiActionInvoker invoker)
        {
            invoker = null;
            switch (action)
            {
            case "read":
            case "create":
            case "update":
            case "destroy":
                break;

            default:
                return(false);
            }
            var proxyInterface = controller.GetType().GetInterfaces().FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IDextopReadProxy <>));

            if (proxyInterface == null)
            {
                return(false);
            }

            var type = typeof(ProxyActionInvoker <>).MakeGenericType(proxyInterface.GetGenericArguments());

            invoker = (IDextopApiActionInvoker)Activator.CreateInstance(type, controller);
            return(true);
        }
        public static bool Try(DextopApiController controller, String action, out IDextopApiActionInvoker invoker)
        {
            invoker = null;
            switch (action)
            {
                case "read":
                case "create":
                case "update":
                case "destroy":
                    break;
                
                default:
                    return false;
            }
            var proxyInterface = controller.GetType().GetInterfaces().FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IDextopReadProxy<>));

            if (proxyInterface==null)
                return false;

            var type = typeof(ProxyActionInvoker<>).MakeGenericType(proxyInterface.GetGenericArguments());
            invoker = (IDextopApiActionInvoker)Activator.CreateInstance(type, controller);
            return true;
        }
 public StandardActionInvoker(DextopApiController controller)
 {
     this.controller = controller;
 }
Exemple #4
0
 public StandardActionInvoker(DextopApiController controller)
 {
     this.controller = controller;
 }