internal static List <OutputFile> ResolveSingleOutputFiles() { var outputFiles = new List <OutputFile>(); if (MainInfoManager.EntityInformation.ConnectionFactory != null) { outputFiles.AddRange(ConnectionFactoryBuilder.Build()); } if (MainInfoManager.EntityInformation.GenericRepository != null) { outputFiles.AddRange(GenericRepositoryBuilder.Build()); } if (MainInfoManager.EntityInformation.DependencyInjection?.Modules != null) { outputFiles.AddRange(MainInfoManager.EntityInformation.DependencyInjection.Modules.Select(x => DependencyInjectionBuilder.Build(x))); } return(outputFiles); }
ConnectionHandler <RabbitMqConnection> GetConnection(IRabbitMqEndpointAddress address) { return(_connectionCache.Retrieve(address.Uri, () => { ConnectionFactoryBuilder builder = _connectionFactoryBuilders.Retrieve(address.Uri, () => { var configurator = new ConnectionFactoryConfiguratorImpl(address); return configurator.CreateBuilder(); }); ConnectionFactory connectionFactory = builder.Build(); var connection = new RabbitMqConnection(connectionFactory); var connectionHandler = new ConnectionHandlerImpl <RabbitMqConnection>(connection); return connectionHandler; })); }
ConnectionHandler <RabbitMqConnection> GetConnection( Cache <ConnectionFactory, ConnectionHandler <RabbitMqConnection> > cache, IRabbitMqEndpointAddress address) { ConnectionFactory factory = SanitizeConnectionFactory(address); return(cache.Get(factory, _ => { if (_log.IsDebugEnabled) { _log.DebugFormat("Creating RabbitMQ connection: {0}", address.Uri); } ConnectionFactoryBuilder builder = _connectionFactoryBuilders.Get(factory, __ => { if (_log.IsDebugEnabled) { _log.DebugFormat("Using default configurator for connection: {0}", address.Uri); } var configurator = new ConnectionFactoryConfiguratorImpl(address); return configurator.CreateBuilder(); }); ConnectionFactory connectionFactory = builder.Build(); if (_log.IsDebugEnabled) { _log.DebugFormat("RabbitMQ connection created: {0}:{1}/{2}", connectionFactory.HostName, connectionFactory.Port, connectionFactory.VirtualHost); } var connection = new RabbitMqConnection(connectionFactory); var connectionHandler = new ConnectionHandlerImpl <RabbitMqConnection>(connection); return connectionHandler; })); }