예제 #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.");
        }
예제 #2
0
 public ServiceInvocationContext(ServiceLocationContext ctx, object[] arguments)
 {
     Id        = Guid.NewGuid();
     Type      = ctx.MatchingType;
     Method    = ctx.Method;
     Arguments = arguments;
     Warnings  = new List <Exception>();
 }