/// <summary>
        /// Initializes a new instance of the <see cref="ExternalManagedDatabase"/> class.
        /// Creates a database that will be managed by the Database Manager.
        /// Make sure to set up the dependencies as explained for each parameter.
        /// </summary>
        /// <param name="dataProvider">
        /// Needs to be connected to a server
        /// ParameterPlaceHolder needs to be set
        /// </param>
        /// <param name="dataProviderInfo">
        /// External: MySql, Postgres etc.
        /// </param>
        public IManagedDatabase InitializeWith(IDataProvider dataProvider, IDataProviderInfo dataProviderInfo)
        {
            _dataProviderInfo = dataProviderInfo;
            DataProvider      = dataProvider;

            return(this);
        }
示例#2
0
 public void _Init()
 {
     _stub = new StubBuilder();
     _mockUserConfiguration = new MockUserConfiguration();
     _mockSettings          = new Settings(_mockUserConfiguration);
     _mySqlProvider         = new MySqlInfo();
     _sqLiteProvider        = new SqLiteInfo();
 }
示例#3
0
 public DataProviderInfoModel(IDataProviderInfo info)
 {
     if (info == null)
     {
         throw new ArgumentNullException(nameof(info));
     }
     _info = info;
 }
示例#4
0
        public IDatabaseSettings SetServerConnectStringFor(
            IDataProviderInfo dataProviderInfo, string serverConnectString)
        {
            string key = ServerSettingsUtility.GetServerConnectKeyFor(dataProviderInfo);

            _settings.Set(key, serverConnectString);
            return(this);
        }
示例#5
0
 public FakeToponymDataProvider(IDataProviderInfo info)
 {
     if (info == null)
     {
         throw new ArgumentNullException(nameof(info));
     }
     Info = info;
 }
        public IDataProviderInfos Support(IDataProviderInfo dataProviderInfo)
        {
            if (!_supportedDataProviders.Contains(dataProviderInfo))
            {
                _supportedDataProviders.Add(dataProviderInfo);
            }

            return(this);
        }
示例#7
0
        /// <summary>
        /// Obtains connection string for current provider from the settings
        /// </summary>
        /// <returns>connection string or null if cone was found</returns>
        public string GetConnectionStringFor(IDataProviderInfo dataProviderInfo)
        {
            if (ConnectionStringExistsFor(dataProviderInfo))
            {
                return
                    (_settings.ConnectionStrings[dataProviderInfo.FullName].ConnectionString.TrimEnd(';'));
            }

            return(null);
        }
示例#8
0
        public IManagedDatabase InitializeWith(IDataProvider dataProvider, IDataProviderInfo dataProviderInfo)
        {
            _dataProviderInfo = dataProviderInfo;
            DataProvider      = dataProvider;

            _databaseDirectory = string.Format("{0}\\{1}\\", Files.LocalUserAppDataPath, Files.DataFolder);

            ValidateDatabaseDirectoryAndRecreateIfNeccessary();

            return(this);
        }
        public ConfigureMySqlDataProviderViewModel(
            IEventAggregator eventAggregator, IDatabaseSettings databaseSettings, IDatabaseConnector databaseConnector)
            : base(eventAggregator, databaseSettings, databaseConnector)
        {
            _dataProviderInfo = new MySqlInfo();

            DetectMySqlAndSetMySqlVersionInfoAccordinly();

            _pokerOfficeSettings = GetPokerofficeSettings();

            Initialize();
        }
示例#10
0
        public void Connect(string connString, IDataProviderInfo dataProviderInfo)
        {
            _dataProviderInfo = dataProviderInfo;
            _providerFactory  = DbProviderFactories.GetFactory(dataProviderInfo.FullName);

            _connection = _providerFactory.CreateConnection();
            _connection.ConnectionString = connString;

            _connection.Open();

            DatabaseName = IsConnectedToDatabase ? Connection.Database : Resources.Status_NotConnectedToDatabase;
        }
示例#11
0
        public IDatabaseSettings SetConnectionStringFor(IDataProviderInfo dataProviderInfo, string connectionString)
        {
            if (!ConnectionStringExistsFor(dataProviderInfo))
            {
                _settings.ConnectionStrings.Add(
                    new ConnectionStringSettings(dataProviderInfo.FullName, connectionString));
            }
            else
            {
                _settings.ConnectionStrings[dataProviderInfo.FullName].ConnectionString = connectionString;
            }

            _settings.Save(ConfigurationSaveMode.Minimal);
            return(this);
        }
 public WeatherFromProviderInfo(IDataProviderInfo dataProviderInfo, IWeatherData weatherData)
 {
     DataProviderInfo = dataProviderInfo;
     WeatherData = weatherData;
 }
示例#13
0
 public IDatabaseSettings SetCurrentDataProviderTo(IDataProviderInfo dataProviderInfo)
 {
     _settings.Set(ServerSettings.ProviderName.ToString(), dataProviderInfo.FullName);
     return(this);
 }
 public DataProviderInfoCashValue(IDataProviderInfo[] infoList)
 {
     if (infoList == null) throw new ArgumentNullException(nameof(infoList));
     InfoListValue = infoList;
     TimeStamp = TimeProvider.Current.UtcNow;
 }
示例#15
0
 internal static string GetServerConnectKeyFor(IDataProviderInfo dataProviderInfo)
 {
     return(string.Format("{0}.{1}", dataProviderInfo.FullName, ServerSettings.ServerConnect));
 }
示例#16
0
 public bool ConnectionStringExistsFor(IDataProviderInfo dataProviderInfo)
 {
     return(_settings.ConnectionStrings[dataProviderInfo.FullName] != null);
 }
示例#17
0
 public IDatabaseConnector InitializeWith(IDataProviderInfo dataProviderInfo)
 {
     _dataProviderInfo = dataProviderInfo;
     return(this);
 }
示例#18
0
        public IDatabaseConnector InitializeFromSettings()
        {
            IDataProviderInfo dataProviderInfo = _databaseSettings.GetCurrentDataProvider();

            return(InitializeWith(dataProviderInfo));
        }
示例#19
0
 public WeatherFromProviderInfo(IDataProviderInfo dataProviderInfo, IWeatherData weatherData)
 {
     DataProviderInfo = dataProviderInfo;
     WeatherData      = weatherData;
 }
示例#20
0
        /// <summary>
        /// Only applies to MySql and Postgres
        /// </summary>
        /// <returns>
        /// Gets the connection string  that is necesary to connect
        /// to the server from the settings
        /// </returns>
        public string GetServerConnectStringFor(IDataProviderInfo dataProviderInfo)
        {
            string key = ServerSettingsUtility.GetServerConnectKeyFor(dataProviderInfo);

            return(_settings.RetrieveString(key));
        }
 public FakeWeatherDataProvider(IDataProviderInfo info)
 {
     if (info == null) throw new ArgumentNullException(nameof(info));
     Info = info;
 }
示例#22
0
 public bool ProviderIsAvailable(IDataProviderInfo dataProviderInfo)
 {
     return(GetAvailableProviders().Any(dp => dp.FullName.Equals(dataProviderInfo.FullName)));
 }