Esempio n. 1
0
            /// <summary>
            /// Creates a new ServiceObject.
            /// </summary>
            /// <param name="serviceInterfaceType">Type of service interface</param>
            /// <param name="service">The service object that is used to invoke methods on</param>
            public ServiceObject(Type serviceInterfaceType, ScsService service)
            {
                Service = service;
                var classAttributes = serviceInterfaceType.GetCustomAttributes(typeof(ScsServiceAttribute), true);

                if (classAttributes.Length <= 0)
                {
                    throw new Exception("Service interface (" + serviceInterfaceType.Name + ") must has ScsService attribute.");
                }

                _methods = new SortedList <string, MethodInfo>();
                buscarMetodos(serviceInterfaceType);
            }
Esempio n. 2
0
 /// <summary>
 /// Creates a new ServiceObject.
 ///
 /// </summary>
 /// <param name="serviceInterfaceType">Type of service interface</param><param name="service">The service object that is used to invoke methods on</param>
 public ServiceObject(Type serviceInterfaceType, ScsService service)
 {
     this.Service = service;
     object[] customAttributes = serviceInterfaceType.GetCustomAttributes(typeof(ScsServiceAttribute), true);
     if (customAttributes.Length <= 0)
     {
         throw new Exception("Service interface (" + serviceInterfaceType.Name + ") must has ScsService attribute.");
     }
     this.ServiceAttribute = customAttributes[0] as ScsServiceAttribute;
     this._methods         = new SortedList <string, MethodInfo>();
     foreach (MethodInfo methodInfo in serviceInterfaceType.GetMethods())
     {
         this._methods.Add(methodInfo.Name, methodInfo);
     }
 }