@ -21,14 +21,14 @@ namespace EntityFrameworkCore.Jet.Data
internal DbConnection InnerConnection { get ; private set ; }
internal JetTransaction ActiveTransaction { get ; set ; }
internal int RowCount { get ; set ; }
internal string ActiveConnectionString { get ; private set ; }
internal string FileNameOrConnectionString = > ConnectionString ;
public const string DefaultDualTableName = "#Dual" ;
/// <summary>
/// Initializes a new instance of the <see cref="JetConnection"/> class.
/// </summary>
@ -325,7 +325,7 @@ namespace EntityFrameworkCore.Jet.Data
: null ;
string connectionString ;
if ( IsConnectionString ( fileNameOrConnectionString ) )
{
// If the connection string is an actual connection string and not just a file path, then we should
@ -354,7 +354,7 @@ namespace EntityFrameworkCore.Jet.Data
}
DataAccessProviderFactory ? ? = JetFactory . Instance . GetDataAccessProviderFactory ( dataAccessProviderType . Value ) ;
// It is possible, that a connection string was provided, that left out the actual ACE/Jet provider
// information, but is in a distinctive style (ODBC or OLE DB) anyway.
// In that case, we need to retrieving the data access provider type's most recent ACE/Jet provider.
@ -369,11 +369,11 @@ namespace EntityFrameworkCore.Jet.Data
if ( provider = = null )
throw new InvalidOperationException ( $"Unable to find any compatible {Enum.GetName(typeof(DataAccessProviderType), dataAccessProviderType)} provider for the connection string: {fileNameOrConnectionString}" ) ;
connectionStringBuilder . SetProvider ( provider ) ;
connectionString = connectionStringBuilder . ToString ( ) ;
}
// Enable ExtendedAnsiSQL when using ODBC to support ODBC 4.0 statements (like CREATE VIEW).
if ( dataAccessProviderType = = DataAccessProviderType . Odbc )
{
@ -385,7 +385,7 @@ namespace EntityFrameworkCore.Jet.Data
}
connectionString = ExpandDatabaseFilePath ( connectionString , DataAccessProviderFactory ) ;
try
{
InnerConnection = InnerConnectionFactory . Instance . OpenConnection (
@ -465,7 +465,7 @@ namespace EntityFrameworkCore.Jet.Data
// SqlCommand will complain if the command text is empty
commandText = Environment . NewLine ;
var command = ( JetCommand ) JetFactory . CreateCommand ( ) ;
var command = ( JetCommand ) JetFactory . CreateCommand ( ) ;
command . CommandText = commandText ;
if ( commandTimeout . HasValue )
@ -519,7 +519,7 @@ namespace EntityFrameworkCore.Jet.Data
string fileNameOrConnectionString ,
DatabaseVersion version = DatabaseVersion . NewestSupported ,
CollatingOrder collatingOrder = CollatingOrder . General ,
string ? databasePassword = null ,
string databasePassword = null ,
SchemaProviderType schemaProviderType = SchemaProviderType . Precise ,
DataAccessProviderType ? dataAccessProviderType = null )
{
@ -532,7 +532,7 @@ namespace EntityFrameworkCore.Jet.Data
/ /
// Create database:
/ /
var databaseCreator = JetDatabaseCreator . CreateInstance ( schemaProviderType ) ;
databaseCreator . CreateDatabase ( fileNameOrConnectionString , version , collatingOrder , databasePassword ) ;
@ -560,7 +560,7 @@ namespace EntityFrameworkCore.Jet.Data
using var connection = new JetConnection ( connectionString , dataAccessProviderFactory ) ;
connection . Open ( ) ;
using var schemaProvider = SchemaProvider . CreateInstance ( schemaProviderType , connection ) ;
schemaProvider . EnsureDualTable ( ) ;
}
@ -570,7 +570,7 @@ namespace EntityFrameworkCore.Jet.Data
public static string GetConnectionString ( string fileNameOrConnectionString , DataAccessProviderType ? dataAccessProviderType = null )
{
var providerType = dataAccessProviderType ? ? JetConfiguration . DefaultDataAccessProviderType ;
var providerType = dataAccessProviderType ? ? JetConfiguration . DefaultDataAccessProviderType ;
return GetConnectionString ( fileNameOrConnectionString , providerType , JetFactory . Instance . GetDataAccessProviderFactory ( providerType ) ) ;
}
@ -589,7 +589,7 @@ namespace EntityFrameworkCore.Jet.Data
= > dataAccessProviderType = = DataAccessProviderType . OleDb
? $"Provider={provider};Data Source={JetStoreDatabaseHandling.ExpandFileName(fileName)}"
: $"Driver={{{provider}}};DBQ={JetStoreDatabaseHandling.ExpandFileName(fileName)}" ;
private static string ExpandDatabaseFilePath ( string connectionString , DbProviderFactory dataAccessProviderFactory )
{
var connectionStringBuilder = dataAccessProviderFactory . CreateConnectionStringBuilder ( ) ;
@ -614,7 +614,7 @@ namespace EntityFrameworkCore.Jet.Data
public bool DatabaseExists ( )
= > DatabaseExists ( _connectionString ) ;
public SchemaProviderType SchemaProviderType { get ; set ; }
public static bool DatabaseExists ( string fileNameOrConnectionString )