Misc updates

pull/39/head
FreddyD 6 years ago
parent 78c1952b3d
commit a60d66f81e

@ -30,6 +30,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Jet.FunctionalTests"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{B7FF1850-23D0-465A-9D45-7EDEB9A23AD8}"
ProjectSection(SolutionItems) = preProject
docs\DevNotes.md = docs\DevNotes.md
docs\README.md = docs\README.md
EndProjectSection
EndProject
@ -42,6 +43,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build help", "build help", "{20B764C9-8664-4609-A743-8CF32BA6CA69}"
ProjectSection(SolutionItems) = preProject
Directory.Build.targets = Directory.Build.targets
NuGet.Config = NuGet.Config
EndProjectSection
EndProject
Global

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-core (nightly)" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
</packageSources>
</configuration>

@ -0,0 +1,56 @@
# Notes for Developers/Builders
## Important Notes as of Feb 21, 2020
- System.Data.OleDb currently has several issues with x86, testing on x64 is recommended.
## System.Data.OleDb Issues
- Current Nuget.org package (version 4.7.0) contains several significant bugs:
- https://github.com/dotnet/runtime/issues/32509
- (fixed, awaiting merge) https://github.com/dotnet/runtime/issues/31177
- (fixed, merged) https://github.com/dotnet/runtime/issues/981
- Use NuGet.Config (see below) to get nightly builds instead of using the published version
## Nuget.Config
- Used to get latest nightly builds of System.Data.OleDb
- When a public release is posted to NuGet.org, having the NuGet.Config file likely won't be necessary
## .NET Core 3.0/3.1 Issues
- using the dynamic keyword with COM objects not supported on .NET Core 3.0/3.1
- instead, System.Data.Jet.csproj includes two COMReference nodes for ADODB.dll & ADOX.dll, which generate strongly-typed references to these packages. No x86/x64 issues have been encountered during preliminary tests, but I believe .NET 5.0 may support using the dynamic keyword with COM objects, so the code could possibly be reverted to the way it was, if issues with the COM wrappers are found.
- Affects AdoxWrapper.cs, JetStoreSchemaDefinitionRetrieve.cs & JetSyntaxHelper.cs
- FYI: Paths to msadox.dll:
- C:\Program Files\Common Files\System\ado
- C:\Program Files (x86)\Common Files\System\ado
## Directory.Build.targets
- Used due to conflict between the EF Core 2.2 and .NET Core 3.1 versions of IAsyncGrouping<,> & IAsyncEnumerable<>. Invoked via setting an Alias attribute on the appropriate PackageReference.
- Affects SharedTypeExtensions.cs
## Test Design Guidelines
- Consider extracting out global test configuration settings to a single file:
- Provider [string]: "Microsoft.ACE.OLEDB.15.0"
- TempDirectoryPath [string]: "C:\TEMP"
- RunSqlCeTests [bool] : true/false
- RunSqlServerTests [bool] : true/false
- RunSqliteTests [bool] : true/false
## Prerequisites for Building/Running Tests
- Install SQL Compact 4.0
- x86 or x64 (whichever applies to the version of Windows used)
- Install Microsoft Access 2013 Runtime (https://www.microsoft.com/en-us/download/details.aspx?id=39358)
- x86, x64, or Both (not sure if installing both x86 and x64 side-by-side works properly)
- The folder "C:\TEMP" must exist, certain tests will throw if it does not
## Test Runner Issues
- Test projects need to use Microsoft.NET.Test.SDK version 16.4.0 or higher to switch between x86/x64, otherwise Visual Studio test runner does not respect the "Processor Architecture for Any CPU" setting and still tries to run x86 tests on x64.
- Refer to: https://developercommunity.visualstudio.com/content/problem/697732/test-runner-wont-execute-net-core-tests-in-32-bit.html
- Ensure xUnit test projects contain a reference to the nuget package xunit.runner.visualstudio to run the test from Visual Studio Test Explorer
## General Resources
- Multitargeting
https://docs.microsoft.com/en-us/dotnet/core/tutorials/libraries#how-to-multitarget
- MS Access Data Manipulation Language
https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/data-manipulation-language
## Outdated Notes that Probably are No Longer Important
- Probably want to set Visual Studio to use PackageReference instead of packages.config by default (Options->Nuget Package Manager)

@ -7,24 +7,6 @@ the .NET Core runtime (netcore and netstandard).
You can find the latest build on [NuGet](https://www.nuget.org/packages/EntityFrameworkCore.Jet/)
## Prerequisites for building tests
- Install SQL Compact 4.0
- x86 or x64 (whichever applies)
- Install Microsoft Access 2013 Runtime (https://www.microsoft.com/en-us/download/details.aspx?id=39358)
- x86, x64, or Both
- (maybe?) Install Microsoft Access Database Engine 2010 Redistributable (https://www.microsoft.com/en-US/download/details.aspx?id=13255)
- x86, x64, or Both
- The folder "C:\TEMP" must exist
- Ensure xUnit test projects contain a reference to the nuget package xunit.runner.visualstudio to run the test from Visual Studio Test Explorer
## Random Notes
- Will need to upgrade test projects to use Microsoft.NET.Test.SDK version 16.4.0 or higher, otherwise Visual Studio test runner still tries to run x86 tests on x64. Refer to: https://developercommunity.visualstudio.com/content/problem/697732/test-runner-wont-execute-net-core-tests-in-32-bit.html
- Paths to msadox.dll:
- C:\Program Files\Common Files\System\ado
- C:\Program Files (x86)\Common Files\System\ado
- Probably want to set Visual Studio to use PackageReference instead of packages.config by default (Options->Nuget Package Manager)
- https://docs.microsoft.com/en-us/dotnet/core/tutorials/libraries#how-to-multitarget
## More documentation
More documentation can be found on project [Wiki](https://www.github.com/bubibubi/EntityFrameworkCore.Jet/wiki)

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net461;netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>EntityFrameworkCore.Jet</RootNamespace>
<AssemblyName>EntityFrameworkCore.Jet</AssemblyName>

@ -24,7 +24,6 @@ namespace System.Data.Jet
}
finally
{
//catalog.ActiveConnection.Close();
((ADODB.Connection)catalog.ActiveConnection).Close();
}
}
@ -50,7 +49,6 @@ namespace System.Data.Jet
}
finally
{
//catalog.ActiveConnection.Close();
((ADODB.Connection)catalog.ActiveConnection).Close();
}
}
@ -75,7 +73,6 @@ namespace System.Data.Jet
}
catch (Exception e)
{
//catalog.ActiveConnection.Close();
((ADODB.Connection)catalog.ActiveConnection).Close();
throw new Exception("Cannot rename index. Cannot retrieve the table '" + tableName + "'", e);
}
@ -87,7 +84,6 @@ namespace System.Data.Jet
}
catch (Exception e)
{
//catalog.ActiveConnection.Close();
((ADODB.Connection)catalog.ActiveConnection).Close();
throw new Exception("Cannot rename index. Cannot retrieve the old index '" + indexName + "'", e);
}
@ -104,7 +100,6 @@ namespace System.Data.Jet
}
finally
{
//catalog.ActiveConnection.Close();
((ADODB.Connection)catalog.ActiveConnection).Close();
}
@ -156,7 +151,6 @@ CREATE UNIQUE INDEX [ParentIdName] ON [MSysAccessStorage] ([ParentId], [Name]);"
try
{
//catalog.ActiveConnection.Close();
var x = ((ADODB.Connection)catalog.ActiveConnection);
x.Close();
}
@ -172,30 +166,7 @@ CREATE UNIQUE INDEX [ParentIdName] ON [MSysAccessStorage] ([ParentId], [Name]);"
private static ADOX.Catalog GetCatalogInstance(string errorPrefix)
{
var catalog = new ADOX.Catalog();
return catalog;
//Type adoxCatalogType;
//dynamic catalog;
//try
//{
// adoxCatalogType = Type.GetTypeFromProgID("ADOX.Catalog", true);
//}
//catch (Exception e)
//{
// throw new Exception(errorPrefix + ". Cannot retrieve ADOX.Catalog type. Check ADOX installation.", e);
//}
//try
//{
// catalog = System.Activator.CreateInstance(adoxCatalogType);
//}
//catch (Exception e)
//{
// throw new Exception(errorPrefix + ". Cannot create an instance of ADOX.Catalog type.", e);
//}
//return catalog;
return new ADOX.Catalog();
}
private static ADOX.Catalog GetCatalogInstanceAndOpen(string errorPrefix, string connectionString)
@ -204,7 +175,6 @@ CREATE UNIQUE INDEX [ParentIdName] ON [MSysAccessStorage] ([ParentId], [Name]);"
try
{
//catalog.ActiveConnection = connectionString;
ADODB.Connection cnn = new ADODB.Connection();
cnn.Open(ConnectionString: connectionString);
catalog.ActiveConnection = cnn;

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net461;netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU;x86;x64</Platforms>
</PropertyGroup>
@ -63,7 +63,7 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Data.OleDb" Version="4.7.0" />
<PackageReference Include="System.Data.OleDb" Version="5.0.0-preview.2.20120.8" />
</ItemGroup>
</Project>

@ -25,7 +25,7 @@ namespace EFCore.Jet.Integration.Test
Helpers.DeleteSqlCeDatabase();
Helpers.CreateSqlCeDatabase();
#elif NETCOREAPP
// SqlCe does not currently support .NET Core, so don't do anything for AssemblyInitialization
#else
throw new PlatformNotSupportedException();
#endif

@ -146,14 +146,19 @@ namespace EFCore.Jet.Integration.Test
{
var optionsBuilder = new DbContextOptionsBuilder<T>().EnableSensitiveDataLogging();
if (dbConnection is SqlCeConnection)
#if NETFRAMEWORK
if (dbConnection is SqlCeConnection)
return optionsBuilder.UseSqlCe(dbConnection).Options;
#else
#elif NETCOREAPP
if (dbConnection is SqlCeConnection)
{
Assert.Inconclusive();
Assert.Inconclusive("SqlCe does not currently support .NET Core");
return default;
}
#else
if (dbConnection is SqlCeConnection)
throw new PlatformNotSupportedException();
#endif
else if (dbConnection is JetConnection)
return optionsBuilder.UseJet(dbConnection).Options;

Loading…
Cancel
Save