/// <summary> /// Registers a singleton type mapping /// </summary> /// <param name="configurator">The <see cref="IDependencyConfigurator"/> object that this method was called on.</param> /// <typeparam name="TService"><see cref="Type"/> that will be requested.</typeparam> /// <typeparam name="TImplementation"><see cref="Type"/> that will actually be returned.</typeparam> /// <returns></returns> public static IDependencyConfigurator AddSingleton <TService, TImplementation>( this IDependencyConfigurator configurator) where TImplementation : class, TService where TService : class { return(configurator.Add <TService, TImplementation>(InstanceLifetime.Singleton)); }
public static void RegisterDependencies(IDependencyConfigurator configurator) { configurator.Register <IClockVM, ClockVM>(); configurator.Register <ITimeZonesDataAdapter, TimeZonesDataAdapter>(); configurator.Register <IConfigurator, IniConfiguratorPrimitive>(); configurator.Register <ILogger, FileLogger>(); }
/// <summary> /// Registers a singleton type mapping where the returned instance will be the given <typeparam name="TService"/> implementation /// </summary> /// <param name="configurator">The <see cref="IDependencyConfigurator"/> object that this method was called on</param> /// <param name="service"><see cref="Type"/> that will be returned</param> /// <returns></returns> public static IDependencyConfigurator AddSingleton <TService>( this IDependencyConfigurator configurator, TService service) where TService : class { return(configurator.Add(service)); }
/// <summary> /// Registers a transient type mapping /// </summary> /// <param name="configurator">The <see cref="IDependencyConfigurator"/> object that this method was called on</param> /// <param name="serviceType"><see cref="Type"/> that will be requested</param> /// <param name="implementationType"><see cref="Type"/> that will actually be returned</param> /// <returns></returns> public static IDependencyConfigurator AddTransient( this IDependencyConfigurator configurator, Type serviceType, Type implementationType) { return(configurator.Add(serviceType, implementationType, InstanceLifetime.Transient)); }
public void SetupDependencies(IDependencyConfigurator injector, string prefix, string defaultKey) { injector.SetupDependency<CreateAccountPresentation, ICreateAccountPresentation>(prefix + defaultKey); injector.SetupDependency<LoginPresentation, ILoginPresentation>(prefix + defaultKey); injector.SetupDependency<HomePresentation, IHomePresentation>(prefix + defaultKey); injector.SetupDependency<StatisticsPresentation, IStatisticsPresentation>(prefix + defaultKey); //injector.SetupDependency<LogoutButtonPresentation, ILogoutButtonPresentation>(prefix + defaultKey); }
/// <summary> /// Registers a singleton type mapping where the returned instance will be given by the provided factory /// </summary> /// <param name="configurator">The <see cref="IDependencyConfigurator"/> object that this method was called on</param> /// <param name="factory">A factory to create new instances of the service implementation</param> /// <typeparam name="TService">Type that will be created</typeparam> /// <returns></returns> public static IDependencyConfigurator AddSingleton <TService>( this IDependencyConfigurator configurator, Func <IDependencyResolver, TService> factory) { return(configurator.Add( typeof(TService), factory, InstanceLifetime.Singleton)); }
public KafkaFlowConfigurator( IDependencyConfigurator dependencyConfigurator, Action <IKafkaConfigurationBuilder> kafka) { var builder = new KafkaConfigurationBuilder(dependencyConfigurator); kafka(builder); dependencyConfigurator.AddSingleton(builder.Build()); }
/// <summary> /// Initializes a new instance of the <see cref="KafkaFlowConfigurator"/> class. /// </summary> /// <param name="dependencyConfigurator">Dependency injection configurator</param> /// <param name="kafka">A handler to setup the configuration</param> public KafkaFlowConfigurator( IDependencyConfigurator dependencyConfigurator, Action <IKafkaConfigurationBuilder> kafka) { var builder = new KafkaConfigurationBuilder(dependencyConfigurator); kafka(builder); this.configuration = builder.Build(); }
/// <summary> /// Registers a singleton type mapping /// </summary> /// <param name="configurator">The <see cref="IDependencyConfigurator"/> object that this method was called on</param> /// <param name="serviceType"><see cref="Type"/> that will be requested</param> /// <param name="implementationType"><see cref="Type"/> that will actually be returned</param> /// <returns></returns> public static IDependencyConfigurator AddSingleton( this IDependencyConfigurator configurator, Type serviceType, Type implementationType) { return(configurator.Add( serviceType, implementationType, InstanceLifetime.Singleton)); }
/// <summary> /// Registers a singleton type mapping where the returned instance will be given by the provided factory /// </summary> /// <param name="configurator">The <see cref="IDependencyConfigurator"/> object that this method was called on</param> /// <param name="serviceType"><see cref="Type"/> that will be requested</param> /// <param name="factory">A factory to create new instances of the service implementation</param> /// <returns></returns> public static IDependencyConfigurator AddSingleton <TImplementation>( this IDependencyConfigurator configurator, Type serviceType, Func <IDependencyResolver, TImplementation> factory) where TImplementation : class { return(configurator.Add( serviceType, factory, InstanceLifetime.Singleton)); }
public void SetupDependencies(IDependencyConfigurator injector, string prefix, string defaultKey) { injector.SetupDependency<CreateAccountPresentation, ICreateAccountPresentation>(prefix + defaultKey); injector.SetupDependency<LoginPresentation, ILoginPresentation>(prefix + defaultKey); injector.SetupDependency<HomePresentation, IHomePresentation>(prefix + defaultKey); injector.SetupDependency<StatisticsPresentation, IStatisticsPresentation>(prefix + defaultKey); injector.SetupDependency<LogoutButtonPresentation, ILogoutButtonPresentation>(prefix + defaultKey); injector.SetupDependency<RoomPresentation, IRoomPresentation>(prefix + defaultKey); injector.SetupDependency<RoomUserDTO, IRoomUserDTO>(prefix + defaultKey); injector.SetupDependency<BattlePresentation, IBattlePresentation>(prefix + defaultKey); injector.SetupDependency<BattleCardPresentation, IBattleCardPresentation>(prefix + defaultKey); injector.SetupDependency<BattlePlayerInfo, IBattlePlayerPresentation>(prefix + defaultKey); }
public static void Configure(IDependencyConfigurator di) { di.Register <ControllerFactory, ControllerFactory>(true); di.Factory(self => self); di.Register <IConnectionService, ConnectionService>(); di.Register <WebSocketConnection, WebSocketConnection>(); di.Register <ClientRepository, ClientRepository>(true); di.Register <IBroadcastService, BroadcastService>(); var types = new ControllerTypes(); di.Factory(d => types); di.Factory <IControllerTypeResolver>(d => types); di.Register <Catchme, Catchme>(true); }
public void SetupDependencies(IDependencyConfigurator injector, string prefix, string defaultKey) { var connBuilder = new SqlConnectionStringBuilder() { InitialCatalog = "CardGame", IntegratedSecurity = true, MultipleActiveResultSets = true, ApplicationName = "EntityFramework" }; //connBuilder.DataSource = "MSSQL"; injector.SetupSingleton<ILog>(new Log(), prefix + defaultKey); injector.SetupSingleton<IMessaging>(new Messaging(), prefix + defaultKey); injector.SetupDependency<MessageQueue, IMessageQueue>(prefix + defaultKey); //injector.PutConfiguration("model-args", new object[] { connBuilder.ToString() }); injector.PutConfiguration("model-args", new object[] { "metadata=res://*/Model.DomainDataModel.csdl|res://*/Model.DomainDataModel.ssdl|res://*/Model.DomainDataModel.msl;provider=System.Data.SqlClient;provider connection string=\"data source=(local);initial catalog=CardGame;integrated security=True;multipleactiveresultsets=True;App=EntityFramework\"" }); }
public void SetupDependencies(IDependencyConfigurator injector, string prefix, string defaultKey) { injector.SetupSingleton<ICardContainer>(() => new CardContainer(), prefix + defaultKey); injector.SetupSingleton<IAccountManager>(() => new AccountManager(), prefix + defaultKey); injector.SetupSingleton<IRoomsManager>(() => new RoomsManager(), prefix + defaultKey); injector.SetupSingleton<IUserStatsManager>(() => new UserStatsManager(), prefix + defaultKey); injector.SetupSingleton<IRankingsManager>(() => new RankingsManager(), prefix + defaultKey); injector.SetupDependency<OperationResult, IOperationResult>(prefix + defaultKey); injector.SetupDependency(typeof(OperationResult<>), typeof(IOperationResult<>), prefix + defaultKey); injector.SetupDependency<Challenge, IChallenge>(prefix + defaultKey); injector.SetupDependency<Challenge, IIssuedChallenge>(prefix + defaultKey); injector.SetupDependency<Challenge, IReceivedChallenge>(prefix + defaultKey); injector.SetupDependency<RoomUser, IRoomUser>(prefix + defaultKey); injector.SetupDependency<UserSession, IUserSession>(prefix + defaultKey); injector.SetupDependency<Session, ISession>(prefix + defaultKey); injector.SetupDependency<BattleRequest, IBattleRequest>(prefix + defaultKey); injector.SetupDependency<UserStats, IUserStats>(prefix + defaultKey); }
public ProducerMiddlewareConfigurationBuilder(IDependencyConfigurator dependencyConfigurator) : base(dependencyConfigurator) { }
public ProducerConfigurationBuilder(IDependencyConfigurator dependencyConfigurator, string name) { this.name = name; this.DependencyConfigurator = dependencyConfigurator; this.middlewareConfigurationBuilder = new ProducerMiddlewareConfigurationBuilder(dependencyConfigurator); }
public TypedHandlerConfigurationBuilder(IDependencyConfigurator dependencyConfigurator) { this.dependencyConfigurator = dependencyConfigurator; }
public KafkaConfigurationBuilder(IDependencyConfigurator dependencyConfigurator) { this.dependencyConfigurator = dependencyConfigurator; }
public static void Configure(IDependencyConfigurator di, IDependencyResolver resolve) { ConfigureController <ChatController>(di, resolve.GetService <ControllerTypes>()); ConfigureController <PlayerPositionController>(di, resolve.GetService <ControllerTypes>()); ConfigureController <CatchmeController>(di, resolve.GetService <ControllerTypes>()); }
public ProducerConfigurationBuilder(IDependencyConfigurator dependencyConfigurator, Type type) { this.DependencyConfigurator = dependencyConfigurator; this.producerType = type; this.middlewareConfigurationBuilder = new ProducerMiddlewareConfigurationBuilder(dependencyConfigurator); }
/// <summary> /// Registers a transient type mapping /// </summary> /// <param name="configurator">The <see cref="IDependencyConfigurator"/> object that this method was called on</param> /// <typeparam name="TService">Type that will be created</typeparam> /// <returns></returns> public static IDependencyConfigurator AddTransient <TService>(this IDependencyConfigurator configurator) where TService : class { return(configurator.Add <TService>(InstanceLifetime.Transient)); }
public ClusterConfigurationBuilder(IDependencyConfigurator dependencyConfigurator) { this.dependencyConfigurator = dependencyConfigurator; }
public ProducerMiddlewareConfigurationBuilder(IDependencyConfigurator dependencyConfigurator) { this.DependencyConfigurator = dependencyConfigurator; }
private static void ConfigureController <TController>(IDependencyConfigurator di, ControllerTypes types) where TController : class { di.Register <TController, TController>(); types.Add(typeof(TController).Name, typeof(TController)); }
public ConsumerConfigurationBuilder(IDependencyConfigurator dependencyConfigurator) { this.DependencyConfigurator = dependencyConfigurator; this.middlewareConfigurationBuilder = new ConsumerMiddlewareConfigurationBuilder(dependencyConfigurator); }
public static void RegisterDependencies(IDependencyConfigurator configurator) { configurator.Register <IWebAPI, WebAPI>(); configurator.Register <ITimeWatcher, TimeWatcher>(); }