예제 #1
0
        // Methods
        public void AddService(object service)
        {
            Object[] objs = null;
            Type     type;

            Type[] interfaces;

            if (service == null)
            {
                throw new ArgumentNullException("service is a null reference ");
            }

            interfaces = service.GetType().GetInterfaces();

            for (int i = 0; i < interfaces.Length; i++)
            {
                objs = interfaces[i].GetCustomAttributes(typeof(ExternalDataExchangeAttribute), true);

                if (objs.Length > 0)
                {
                    break;
                }
            }

            if (objs == null || objs.Length == 0)
            {
                throw new InvalidOperationException("Service does not implement an interface with the ExternalDataExchange attribute.");
            }

            Runtime.AddService(service);
        }
예제 #2
0
        protected virtual void AddServices()
        {
            ExternalDataExchangeService dataService = new ExternalDataExchangeService();

            Runtime.AddService(dataService);

            //OrderService orderService = OrderService.Instance;
            //dataService.AddService(orderService);

            //OrderTransactionService txnService = new OrderTransactionService();
            //Runtime.AddService(txnService);

            //ContextService = new HttpContextWrapper();
        }