Пример #1
0
        private void InvokeMethod(string entityName, string actionName, object[] args)
        {
            var locationContext =
                new ServiceLocationContext(entityName, actionName, args.Select(a => a.GetType()).ToArray());

            _locator.LocateService(locationContext);

            if (locationContext.Error != null)
            {
                throw locationContext.Error;
            }

            var invocationContext = new ServiceInvocationContext(locationContext, new object[] { 2 });

            _invoker.InvokeService(invocationContext);

            if (invocationContext.NotImplemented)
            {
                Console.WriteLine("Method not implemnented");
            }
            if (invocationContext.Error != null)
            {
                throw invocationContext.Error;
            }

            Console.WriteLine($"Action {entityName}.{actionName} completed.");
        }