public IEnumerable <RegisteredServiceType> GetServiceTypes(RpcServiceDefinitionSide definitionType)
        {
            var rpcServiceAttribute = this.ServiceType.GetCustomAttribute <RpcServiceAttribute>(false);

            if (rpcServiceAttribute != null &&
                (definitionType == RpcServiceDefinitionSide.Both ||
                 rpcServiceAttribute.ServiceDefinitionSide == RpcServiceDefinitionSide.Both ||
                 definitionType == rpcServiceAttribute.ServiceDefinitionSide))
            {
                yield return(new RegisteredServiceType(this.ServiceType, null, this.ServerOptions));
            }
        }
 public IEnumerable <RegisteredServiceType> GetServiceTypes(RpcServiceDefinitionSide definitionType)
 {
     foreach (var type in this.ServicesAssembly.ExportedTypes)
     {
         if (type.IsInterface)
         {
             var rpcServiceAttribute = type.GetCustomAttribute <RpcServiceAttribute>(false);
             if (rpcServiceAttribute != null &&
                 (definitionType == RpcServiceDefinitionSide.Both ||
                  rpcServiceAttribute.ServiceDefinitionSide == RpcServiceDefinitionSide.Both ||
                  definitionType == rpcServiceAttribute.ServiceDefinitionSide))
             {
                 yield return(new RegisteredServiceType(type, null, this.ServerOptions));
             }
         }
     }
 }
        public static List <RpcServiceInfo> GetAllServices(Type serviceType, Type?implementationType, RpcServiceDefinitionSide serviceDefinitionType, bool ignoreUnknownInterfaces)
        {
            var allServices         = new List <RpcServiceInfo>();
            var declaredServiceInfo = GetServiceInfoFromType(serviceType, implementationType, !ignoreUnknownInterfaces);

            if (declaredServiceInfo != null)
            {
                if (serviceDefinitionType == RpcServiceDefinitionSide.Both ||
                    declaredServiceInfo.DefinitionSide == RpcServiceDefinitionSide.Both ||
                    serviceDefinitionType == declaredServiceInfo.DefinitionSide)
                {
                    declaredServiceInfo.IsDeclaredService = true;
                    allServices.Add(declaredServiceInfo);
                }
            }

            var interfaces = serviceType.GetInterfaces();

            foreach (var inheritedInterfaceType in interfaces)
            {
                if (inheritedInterfaceType.Equals(typeof(IRpcProxy)) ||
                    inheritedInterfaceType.Equals(typeof(IEquatable <IRpcProxy>)) ||
                    inheritedInterfaceType.Equals(typeof(IDisposable)))
                {
                    continue;
                }

                var interfaceServiceInfo = GetServiceInfoFromType(inheritedInterfaceType, implementationType, !ignoreUnknownInterfaces);
                if (interfaceServiceInfo != null)
                {
                    if (serviceDefinitionType == RpcServiceDefinitionSide.Both ||
                        interfaceServiceInfo.DefinitionSide == RpcServiceDefinitionSide.Both ||
                        serviceDefinitionType == interfaceServiceInfo.DefinitionSide)

                    {
                        allServices.Add(interfaceServiceInfo);
                    }
                }
            }

            return(allServices);
        }
 public static List <RpcServiceInfo> GetAllServices(Type serviceType, RpcServiceDefinitionSide serviceDefinitionType, bool ignoreUnknownInterfaces)
 {
     return(GetAllServices(serviceType, null, serviceDefinitionType, ignoreUnknownInterfaces));
 }