Ejemplo n.º 1
0
        private string InitConnectionString(ProviderType provider)
        {
            if (!MsAccessDataHelper.HasProvider(provider))
            {
                throw new InvalidOperationException(string.Format(Resources.ProviderNotInstaller, provider.ToString()));
            }

            _databasePath = GenerateDatabaseName();
            if (!string.IsNullOrEmpty(_sourceDatabasePath))
            {
                File.Copy(_sourceDatabasePath, _databasePath, true);
            }
            else if (_sourceDatabaseStream != null)
            {
                using (FileStream writer = new FileStream(_databasePath, FileMode.Create, FileAccess.Write))
                {
                    _sourceDatabaseStream.CopyTo(writer);
                }
            }
            else
            {
                MsAccessDataHelper.CreateEmptyDatabase(_databasePath, provider);
            }
            return(MsAccessDataHelper.CreateConnectionString(_databasePath, provider));
        }
Ejemplo n.º 2
0
 public static void SkipTestIfJetProviderNotAvailable()
 => Skip.If(!MsAccessDataHelper.HasProvider(ProviderType.Jet),
            string.Format(ProviderNotAvailableMessage, MsAccessDataHelper.JetProviderBase));