Пример #1
0
        public void Initialize()
        {
            _dbSetting = new DbSettings();
            _dbSetting.Load();

            // Creating ConnectionString from DbSettings
            var builder = new SqlConnectionStringBuilder();
            builder.DataSource = _dbSetting.Datasource;
            builder.IntegratedSecurity = _dbSetting.IntegratedSecurity;

            if (!builder.IntegratedSecurity)
            {
                builder.UserID = _dbSetting.Login;
                builder.Password = _dbSetting.Password;
            }

            builder.InitialCatalog = _dbSetting.Initialcatalogue;
            _connectionString = builder.ConnectionString;

            _connection = new SqlConnection(_connectionString);
        }
Пример #2
0
 public DBSettingsViewModel()
 {
     _dbSettings = new DbSettings();
     _dbSettings.Load();
     SaveCommand = new CustomSaveCommand(Save, CanSave);
 }