/// <summary>
 /// Initializes a new instance of the <see cref="FailoverInjectionInvoker" /> class.
 /// </summary>
 /// <param name="serviceCommandProvider">The service command provider.</param>
 /// <param name="serviceEntryManager">The service entry manager.</param>
 /// <param name="typeConvertibleService">The type convertible service.</param>
 public FailoverInjectionInvoker(IServiceCommandProvider serviceCommandProvider,
                                 IServiceEntryManager serviceEntryManager, ITypeConvertibleService typeConvertibleService)
 {
     _serviceCommandProvider = serviceCommandProvider;
     _serviceEntryManager    = serviceEntryManager;
     _typeConvertibleService = typeConvertibleService;
 }
 public ServiceEntryFactory(IServiceProvider serviceProvider, IServiceIdGenerator serviceIdGenerator,
                            ITypeConvertibleService typeConvertibleService)
 {
     _serviceProvider        = serviceProvider;
     _serviceIdGenerator     = serviceIdGenerator;
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 3
0
 public ClrServiceEntryFactory(CPlatformContainer serviceProvider, IServiceIdGenerator serviceIdGenerator, ITypeConvertibleService typeConvertibleService, IValidationProcessor validationProcessor)
 {
     _serviceProvider        = serviceProvider;
     _serviceIdGenerator     = serviceIdGenerator;
     _typeConvertibleService = typeConvertibleService;
     _validationProcessor    = validationProcessor;
 }
Esempio n. 4
0
 public ClrServiceEntryFactory(IServiceProvider serviceProvider, IServiceIdGenerator serviceIdGenerator, ITypeConvertibleService typeConvertibleService, ILoggerFactory loggerFactory)
 {
     _serviceProvider        = serviceProvider;
     _serviceIdGenerator     = serviceIdGenerator;
     _typeConvertibleService = typeConvertibleService;
     _logger = loggerFactory.CreateLogger <ClrServiceEntryFactory>();
 }
Esempio n. 5
0
 public ActionFilterAttribute(IEnumerable <IExceptionFilter> filters)
 {
     _serializer             = ServiceLocator.Current.Resolve <ISerializer <string> >();
     _serviceEntryLocate     = ServiceLocator.Current.Resolve <IServiceEntryLocate>();
     _typeConvertibleService = ServiceLocator.Current.Resolve <ITypeConvertibleService>();
     _filters = filters;
 }
Esempio n. 6
0
        public ServiceProxyFactory(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService, IServiceProvider serviceProvider)
        {
            _remoteInvokeService    = remoteInvokeService;
            _typeConvertibleService = typeConvertibleService;

            _serviceProvider = serviceProvider;
        }
 public UserServiceClientProxy(
     IRemoteInvokeService remoteInvokeService,
     ITypeConvertibleService typeConvertibleService,
     String serviceKey, CPlatformContainer serviceProvider) :
     base(remoteInvokeService, typeConvertibleService, serviceKey, serviceProvider)
 {
 }
 public ServiceEntryFactory(IServiceProvider serviceProvider, IServiceIdGenerator serviceIdGenerator,
                            ITypeConvertibleService typeConvertibleService, IAuthorizationServerProvider authorizationServerProvider)
 {
     _serviceProvider        = serviceProvider;
     _serviceIdGenerator     = serviceIdGenerator;
     _typeConvertibleService = typeConvertibleService;
     _authorization          = authorizationServerProvider;
 }
Esempio n. 9
0
 public FailoverHandoverInvoker(IRemoteInvokeService remoteInvokeService, IServiceCommandProvider commandProvider,
                                ITypeConvertibleService typeConvertibleService, IBreakeRemoteInvokeService breakeRemoteInvokeService)
 {
     _remoteInvokeService       = remoteInvokeService;
     _typeConvertibleService    = typeConvertibleService;
     _breakeRemoteInvokeService = breakeRemoteInvokeService;
     _commandProvider           = commandProvider;
 }
Esempio n. 10
0
 protected ServiceProxyBase(IRemoteInvokeService remoteInvokeService,
                            ITypeConvertibleService typeConvertibleService, String serviceKey, CPlatformContainer serviceProvider)
 {
     _remoteInvokeService       = remoteInvokeService;
     _typeConvertibleService    = typeConvertibleService;
     _serviceKey                = serviceKey;
     _serviceProvider           = serviceProvider;
     _commandProvider           = serviceProvider.GetInstances <IServiceCommandProvider>();
     _breakeRemoteInvokeService = serviceProvider.GetInstances <IBreakeRemoteInvokeService>();
 }
 public ServiceProxyFactory(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService, IEnumerable <Type> serviceTypes, IEnumerable <Type> clientTypes)
 {
     _remoteInvokeService    = remoteInvokeService;
     _typeConvertibleService = typeConvertibleService;
     _serviceTypes           = serviceTypes;
     foreach (var type in clientTypes)
     {
         types.TryAdd(type, new ConcurrentDictionary <EndPoint, object>());
     }
 }
Esempio n. 12
0
 public HttpExecutor(IServiceEntryLocate serviceEntryLocate, IServiceRouteProvider serviceRouteProvider,
                     IAuthorizationFilter authorizationFilter,
                     ITypeConvertibleService typeConvertibleService)
 {
     _serviceEntryLocate     = serviceEntryLocate;
     _typeConvertibleService = typeConvertibleService;
     _serviceRouteProvider   = serviceRouteProvider;
     _authorizationFilter    = authorizationFilter;
     //_serviceProxyProvider = serviceProxyProvider;
     _diagnosticListener = new DiagnosticListener("BimTechDiagnosticListener");
 }
Esempio n. 13
0
 public ServiceProxyFactory(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService,
                            IServiceProvider serviceProvider, IEnumerable <Type> types)
 {
     _remoteInvokeService    = remoteInvokeService;
     _typeConvertibleService = typeConvertibleService;
     _serviceProvider        = serviceProvider;
     if (types != null)
     {
         _serviceTypes = _serviceProvider.GetService <IServiceProxyGenerater>().GenerateProxys(types).ToArray();
     }
 }
Esempio n. 14
0
 public ServiceProxyFactory(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService,
                            IServiceProvider serviceProvider, IEnumerable <Type> types, IEnumerable <string> namespaces)
 {
     _remoteInvokeService    = remoteInvokeService;
     _typeConvertibleService = typeConvertibleService;
     _serviceProvider        = serviceProvider;
     if (types != null)
     {
         RegisterProxType(namespaces.ToArray(), types.ToArray());
     }
 }
Esempio n. 15
0
 public HttpServiceExecutor(IServiceEntryLocate serviceEntryLocate, IServiceRouteProvider serviceRouteProvider,
                            IAuthorizationFilter authorizationFilter,
                            ILogger <HttpServiceExecutor> logger, CPlatformContainer serviceProvider, ITypeConvertibleService typeConvertibleService)
 {
     _serviceEntryLocate     = serviceEntryLocate;
     _logger                 = logger;
     _serviceProvider        = serviceProvider;
     _typeConvertibleService = typeConvertibleService;
     _serviceRouteProvider   = serviceRouteProvider;
     _authorizationFilter    = authorizationFilter;
 }
Esempio n. 16
0
 public HttpExecutor(IServiceEntryLocate serviceEntryLocate, IServiceRouteProvider serviceRouteProvider,
                     IAuthorizationFilter authorizationFilter,
                     ILogger <HttpExecutor> logger, CPlatformContainer serviceProvider, IServiceProxyProvider serviceProxyProvider, ITypeConvertibleService typeConvertibleService)
 {
     _serviceEntryLocate     = serviceEntryLocate;
     _logger                 = logger;
     _serviceProvider        = serviceProvider;
     _typeConvertibleService = typeConvertibleService;
     _serviceRouteProvider   = serviceRouteProvider;
     _authorizationFilter    = authorizationFilter;
     _serviceProxyProvider   = serviceProxyProvider;
     _diagnosticListener     = new DiagnosticListener(DiagnosticListenerExtensions.DiagnosticListenerName);
 }
Esempio n. 17
0
 protected ServiceProxyBase(IRemoteInvokeService remoteInvokeService,
                            ITypeConvertibleService typeConvertibleService, String serviceKey, CPlatformContainer serviceProvider)
 {
     _remoteInvokeService       = remoteInvokeService;
     _typeConvertibleService    = typeConvertibleService;
     _serviceKey                = serviceKey;
     _serviceProvider           = serviceProvider;
     _commandProvider           = serviceProvider.GetInstances <IServiceCommandProvider>();
     _breakeRemoteInvokeService = serviceProvider.GetInstances <IBreakeRemoteInvokeService>();
     if (serviceProvider.Current.IsRegistered <IInterceptor>())
     {
         _interceptor = serviceProvider.GetInstances <IInterceptor>();
     }
 }
Esempio n. 18
0
        private void SetSampleParameterValue(ITypeConvertibleService typeConvertibleService, object parameter,
                                             ParameterDescriptor parameterDescriptor, List <object> list)
        {
            var dict =
                (IDictionary <string, object>)typeConvertibleService.Convert(parameter,
                                                                             typeof(IDictionary <string, object>));
            var parameterVal = parameterDescriptor.ParameterInfo.GetDefaultValue();

            if (dict.ContainsKey(parameterDescriptor.Name))
            {
                parameterVal = dict[parameterDescriptor.Name];
            }

            list.Add(parameterVal);
        }
 protected ServiceProxyBase(IRemoteInvokeService remoteInvokeService,
                            ITypeConvertibleService typeConvertibleService, String serviceKey, CPlatformContainer serviceProvider)
 {
     _remoteInvokeService       = remoteInvokeService;
     _typeConvertibleService    = typeConvertibleService;
     _serviceKey                = serviceKey;
     _serviceProvider           = serviceProvider;
     _commandProvider           = serviceProvider.GetInstances <IServiceCommandProvider>();
     _breakeRemoteInvokeService = serviceProvider.GetInstances <IBreakeRemoteInvokeService>();
     if (serviceProvider.Current.IsRegistered <IInterceptor>())
     {
         var interceptors = serviceProvider.GetInstances <IEnumerable <IInterceptor> >();
         _interceptors     = interceptors.Where(p => !typeof(CacheInterceptor).IsAssignableFrom(p.GetType()));
         _cacheInterceptor = interceptors.Where(p => typeof(CacheInterceptor).IsAssignableFrom(p.GetType())).FirstOrDefault();
     }
 }
Esempio n. 20
0
        private static string GetHashKey(object[] parameterValues, ParameterDescriptor parameterDescriptor, int index,
                                         ITypeConvertibleService typeConvertibleService)
        {
            string hashKey;

            if (parameterDescriptor.IsSample)
            {
                var propVal = parameterValues[index];
                if (propVal == null)
                {
                    throw new LmsException("hashKey指定的值不允许为空");
                }

                hashKey = propVal.ToString();
            }
            else
            {
                var parameterValue =
                    typeConvertibleService.Convert(parameterValues[index], parameterDescriptor.Type);
                var hashKeyProp = parameterDescriptor.Type
                                  .GetProperties().First();
                var hashKeyProviderProps = parameterDescriptor.Type
                                           .GetProperties()
                                           .Where(p => p.GetCustomAttributes().OfType <IHashKeyProvider>().Any());
                if (hashKeyProviderProps.Any())
                {
                    hashKeyProp = hashKeyProviderProps.First();
                }

                var propValue = hashKeyProp.GetValue(parameterValue);
                if (propValue == null)
                {
                    throw new LmsException("hashKey指定的属性的值不允许为空");
                }

                hashKey = propValue.ToString();
            }

            return(hashKey);
        }
Esempio n. 21
0
        private static List <dynamic> ProxyAll()
        {
            var serviceProvider      = Builder();
            var serviceProxyGenerate = serviceProvider.GetRequiredService <IServiceProxyGenerater>();
            var serviceProxyFactory  = serviceProvider.GetRequiredService <IServiceProxyFactory>();

            var path  = AppDomain.CurrentDomain.BaseDirectory;
            var files = new DirectoryInfo(path).GetFiles();
            var types = (from file in files
                         where file.Name.Contains("interfaces") && file.Extension.Contains("dll")
                         from type in Assembly.LoadFrom(file.ToString()).GetExportedTypes()
                         where type.IsInterface
                         select type).ToList();

            var objs = serviceProxyGenerate.GenerateProxys(types)
                       .Select(proxy => serviceProxyFactory.CreateProxy(proxy))
                       .Cast <dynamic>().ToList();

            IRemoteInvokeService    = serviceProvider.GetRequiredService <IRemoteInvokeService>();
            ITypeConvertibleService = serviceProvider.GetRequiredService <ITypeConvertibleService>();

            return(objs);
        }
 public DefaultValidationProcessor(ITypeConvertibleService typeConvertibleService)
 {
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 23
0
 public ServiceProxyFactory(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService)
 {
     _remoteInvokeService = remoteInvokeService;
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 24
0
 public ClrServiceEntryFactory(IServiceInstanceFactory serviceFactory, IServiceIdGenerator serviceIdGenerator, ITypeConvertibleService typeConvertibleService)
 {
     _serviceFactory = serviceFactory;
     _serviceIdGenerator = serviceIdGenerator;
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteServiceProxy" /> class.
 /// </summary>
 /// <param name="remoteInvokeService">The remote invoke service.</param>
 /// <param name="typeConvertibleService">The type convertible service.</param>
 /// <param name="serviceKey">The service key.</param>
 /// <param name="serviceProvider">The service provider.</param>
 /// <param name="serviceRouteProvider">The service route provider.</param>
 public RemoteServiceProxy(IRemoteInvokeService remoteInvokeService,
                           ITypeConvertibleService typeConvertibleService, string serviceKey,
                           CPlatformContainer serviceProvider, IServiceRouteProvider serviceRouteProvider
                           ) : base(remoteInvokeService, typeConvertibleService, serviceKey, serviceProvider, serviceRouteProvider)
 {
 }
 public ServiceProxyFactory(IRemoteServiceInvoker remoteServiceInvoker, ITypeConvertibleService typeConvertibleService)
 {
     _remoteServiceInvoker   = remoteServiceInvoker;
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 27
0
 public ClrServiceEntryFactory(IServiceInstanceFactory serviceFactory, IServiceIdGenerator serviceIdGenerator, ITypeConvertibleService typeConvertibleService)
 {
     _serviceFactory         = serviceFactory;
     _serviceIdGenerator     = serviceIdGenerator;
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 28
0
 protected ServiceProxyBase(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService, EndPoint endPoint)
 {
     _remoteInvokeService    = remoteInvokeService;
     _typeConvertibleService = typeConvertibleService;
     _endPoint = endPoint;
 }
Esempio n. 29
0
 public ClrServiceEntryFactory(CPlatformContainer serviceProvider, IServiceIdGenerator serviceIdGenerator, ITypeConvertibleService typeConvertibleService)
 {
     _serviceProvider        = serviceProvider;
     _serviceIdGenerator     = serviceIdGenerator;
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 30
0
 protected ServiceProxyBase(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService)
 {
     _remoteInvokeService    = remoteInvokeService;
     _typeConvertibleService = typeConvertibleService;
 }
Esempio n. 31
0
 public ServiceProxyFactory(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService,
                            IServiceProvider serviceProvider, IServiceRouteProvider serviceRouteProvider) : this(remoteInvokeService, typeConvertibleService, serviceProvider, serviceRouteProvider, null, null)
 {
 }
 public ServiceProxyFactory(IRemoteInvokeService remoteInvokeService, ITypeConvertibleService typeConvertibleService)
 {
     _remoteInvokeService    = remoteInvokeService;
     _typeConvertibleService = typeConvertibleService;
 }