/// <summary> /// Creates and publish app resource server implementation. /// </summary> public static IAppResourceServer CreateAndPublishResourceServer(IServicePublisher publisher, string schemeName) { var srv = CreateResourceServer(publisher, schemeName); publisher.Publish(srv); return(srv); }
/// <summary> /// Зарегистрировать все фабрики и сканировать вместе с ними. /// </summary> public static void RegisterAndScan( IServicePublisher publisher, IExtensionManager extensionManager, Type[] types) { extensionManager.Scan(new StrategyFactoryStrategy(publisher), types); ScanWithAllFactories(publisher, extensionManager, types); }
public static IDisposable Publish <T>( [NotNull] this IServicePublisher publisher, [NotNull] Func <IServicePublisher, T> instanceFactory) where T : class { Code.NotNull(publisher, nameof(publisher)); Code.NotNull(instanceFactory, nameof(instanceFactory)); return(publisher.Publish(typeof(T), instanceFactory)); }
public static IDisposable Publish <T>( [NotNull] this IServicePublisher publisher, [NotNull] T serviceInstance) where T : class { Code.NotNull(publisher, nameof(publisher)); Code.NotNull(serviceInstance, nameof(serviceInstance)); return(publisher.Publish(typeof(T), serviceInstance)); }
/// <summary> /// Инициализирует экземпляр. /// </summary> protected RegElementsStrategy(IServicePublisher publisher) { if (publisher == null) { throw new ArgumentNullException(nameof(publisher)); } Publisher = publisher; }
/// <summary> /// Creates service publishing strategy. /// </summary> public static IExtensionAttachmentStrategy CreateServiceStrategy([NotNull] IServicePublisher publisher) { if (publisher == null) { throw new ArgumentNullException(nameof(publisher)); } return(new ServicePublishingStrategy(publisher)); }
/// <summary> /// 服务订阅 /// </summary> /// <param name="servicePublisher"></param> /// <param name="serviceTypes">服务类型</param> /// <param name="host">服务Host</param> /// <param name="port">服务端口</param> /// <param name="serializerName">序列化器名称</param> /// <returns></returns> public static IServicePublisher Publish(this IServicePublisher servicePublisher, IEnumerable <Type> serviceTypes, string host, int port, string serializerName) { foreach (var serviceType in serviceTypes) { servicePublisher.Publish(serviceType, host, port, serializerName); } return(servicePublisher); }
public static IDisposable Publish <T>( [NotNull] this IServicePublisher publisher, [NotNull] Func <IServicePublisher, T> instanceFactory) where T : class { Code.NotNull(publisher, nameof(publisher)); Code.NotNull(instanceFactory, nameof(instanceFactory)); // DONTTOUCH: for valid overload resolution (fails on net35). // ReSharper disable once RedundantCast return(publisher.Publish(typeof(T), instanceFactory)); }
/// <summary> /// Create and publish active parts manager. /// </summary> public static ActivePartManager CreateAndPublishManager([NotNull] IServicePublisher servicePublisher) { if (servicePublisher == null) { throw new ArgumentNullException(nameof(servicePublisher)); } var mgr = new ActivePartManager(servicePublisher); servicePublisher.Publish <IActivePartManager>(mgr); return(mgr); }
public DelegateStrategy( [NotNull] IServicePublisher publisher, [NotNull] Func <ExtensionAttachmentContext, TAttr, TInfo> creator, [CanBeNull] Type elementType) : base(publisher) { if (publisher == null) { throw new ArgumentNullException(nameof(publisher)); } _creator = creator; _elementType = elementType; }
/// <summary> /// 使用服务发布 /// </summary> /// <param name="nodeServer"></param> /// <param name="servicePublisher">服务发布器</param> /// <param name="serializerName">序列化器名称</param> /// <returns></returns> public static INodeServer UseServicePublish(this INodeServer nodeServer, IServicePublisher servicePublisher, string serializerName) { nodeServer.OnStarted += arg => { var serviceTypes = arg.Routes.Where(r => r.Enabled).Select(r => r.ServiceType).Distinct(); servicePublisher.Publish(serviceTypes, arg.Host, arg.Port, serializerName); }; nodeServer.OnStopped += arg => { servicePublisher.Dispose(); }; return(nodeServer); }
public static IDisposable Publish <T>( [NotNull] this IServicePublisher publisher, [NotNull] Func <IServicePublisher, T> instanceFactory) where T : class { Code.NotNull(publisher, nameof(publisher)); Code.NotNull(instanceFactory, nameof(instanceFactory)); // DONTTOUCH: for valid overload resolution (fails on net35). #if LESSTHAN_NET40 // Hack for CS0030 Cannot convert type 'System.Func<CodeJam.Services.IServicePublisher, T>' to 'System.Func<CodeJam.Services.IServicePublisher, object>' return(publisher.Publish(typeof(T), new Func <IServicePublisher, object>(sp => instanceFactory(sp)))); #else // ReSharper disable once RedundantCast return(publisher.Publish(typeof(T), (Func <IServicePublisher, object>)instanceFactory)); #endif }
public object GetInstance(IServicePublisher publisher, Type serviceType) { if (_instance == null) { lock (this) if (_instance == null) { _instance = _factory(publisher); if (_instance == null) { throw new InvalidOperationException($"Factory for service of type '{serviceType}' returns null"); } } } return(_instance); }
public static IExtensionAttachmentStrategy CreateStrategy <TInfo, TAttr, TElement>( [NotNull] IServicePublisher publisher, [NotNull] Func <ExtensionAttachmentContext, TAttr, TInfo> infoCreator) where TAttr : Attribute where TInfo : class { if (publisher == null) { throw new ArgumentNullException(nameof(publisher)); } if (infoCreator == null) { throw new ArgumentNullException(nameof(infoCreator)); } return(CreateStrategy(publisher, infoCreator, typeof(TElement))); }
public static IExtensionAttachmentStrategy CreateStrategy <TKey, TInfo, TAttr>( [NotNull] IServicePublisher publisher, [NotNull] Func <ExtensionAttachmentContext, TAttr, TInfo> infoCreator) where TAttr : Attribute where TInfo : class, IKeyedElementInfo <TKey> where TKey : class { if (publisher == null) { throw new ArgumentNullException(nameof(publisher)); } if (infoCreator == null) { throw new ArgumentNullException(nameof(infoCreator)); } return(new DelegateStrategy <TKey, TInfo, TAttr>(publisher, infoCreator, null)); }
public DBDriverRegStrategy(IServicePublisher publisher) : base(publisher) { }
public NavigationTreeProviderStrategy(IServicePublisher publisher) : base(publisher) { }
/// <summary> /// Инициализирует экземпляр. /// </summary> public RegCmdLineRulesProvidersStrategy(IServicePublisher publisher) : base(publisher) { }
public TextMacrosProviderStrategy(IServicePublisher publisher) : base(publisher) { }
/// <summary> /// Инициализирует экземпляр. /// </summary> public ServicePublishingStrategy(IServicePublisher publisher) { _publisher = publisher; }
/// <summary> /// Инициализирует экземпляр. /// </summary> public StrategyFactoryStrategy(IServicePublisher publisher) : base(publisher) { }
/// <summary> /// Инициализирует экземпляр. /// </summary> protected RegKeyedElementsStrategy(IServicePublisher publisher) : base(publisher) { }
public Engine(IProductDbSender mongoRepositorySender, IServicePublisher publisher) { _mongo = mongoRepositorySender; _publisher = publisher; }
public RegFruitStrategy(IServicePublisher publisher) : base(publisher) { }
/// <include file='../CommonXmlDocs.xml' path='common-docs/def-ctor/*'/> public ActivePartRegStrategy(IServicePublisher publisher) : base(publisher) { }
public NamedElementStrategy(IServicePublisher publisher) : base(publisher) { }
public MenuProviderStrategy(IServicePublisher publisher) : base(publisher) { }
/// <summary> /// Инициализирует экземпляр. /// </summary> public ConfigSectionStrategy(IServicePublisher publisher) : base(publisher) { }
public object GetInstance(IServicePublisher publisher, Type serviceType) => _instance;
public ExtInfoProvidersStrategy(IServicePublisher publisher) : base(publisher) { }