0

In a new WebAPI project (trying ASP.NET Core 1.0) we have a requirement to query a legacy database "Pervasive SQL" using the ADO.NET Provider they provide. However they don't have a EF6 provider so we are stuck using EF5.

Skipping Entity Framework and using the ADO.NET PSqlConnection directly requires "System.Data 2.0.0.0". That makes me think the provider is compiled on .NET Framework 2.0 (or 3.5).

project.json

  "frameworks": {
    "net451": { },
    "dnx46": {
      "dependencies": {
        "EntityFramework": "5.0.0",
        "Pervasive.Data.SQLClient.Entity": "1.0.0-*",
        "Pervasive.Data.SqlClient": "1.0.0-*",
        "Pervasive.Data.Common": "1.0.0-*"
      }
    }
  }

Running "dnu build" results into the following exception

xx\..\Controllers\ValuesController.cs(22,18): DNX,Version=v4.6 error CS0012: The type 'DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Build failed.
    0 Warning(s)
    2 Error(s)

The real question: Does dnx46 require at least .NET Framework 4.5.1 ? Or is it somehow possible to referencing .NET Framework 3.5 (or 2.0) from ASP.NET Core 1.0?

rfcdejong
  • 2,219
  • 1
  • 25
  • 51

1 Answers1

1

The version of the moniker tells you already: It requires .NET Framework 4.6.

For 4.5.1 you need the dnx451 moniker.

But the essence is, 4.5 is minimum framework to use the new ASP.NET Core 1.0 (ASP.NET 5). You can see the matrix and how the moniker work on the ".Net Platform Standard" page on github.

Observations

  • If a library targets .NET Platform Standard version 1.3, it can only run on .NET Framework 4.6 or later, Universal Windows Platform 10 (UWP), DNX Core 5.0 and Mono/Xamarin platforms.
  • If a library targets .NET Platform Standard version 1.3, it can consume libraries from all previous .NET Platform Standard versions (1.2, 1.1, 1.0).
  • The earliest .NET Framework to support a .NET Platform Standard version is .NET Framework 4.5. This is because the new portable API surface area (aka System.Runtime based surface area) that is used as the foundation for the .NET Platform Standard only became available in that version of .NET Framework. Targeting .NET Framework <= 4.0 requires multi-targeting.
  • Each .NET Platform Standard version enables more API surface, which means it's available on fewer platforms. As the platforms update, their newer versions jump up into newer .NET Platform Standard versions.
  • Platforms which have stopped updating -- like Silverlight on Windows Phone -- will only ever be available in the earliest .NET Platform Standard versions.

Note

Please note that the moniker described there are for the current nightly builds. There are slight differences to the current RC1 release, i.e. it's dnx and dnxcore for dnx applications (ASP.NET, Console, unit-test projects) and net and dotnet for "Class Library (Package)". In RC2 current builds and RC it will be net and netstandard (also see this answer).

Community
  • 1
  • 1
Tseng
  • 61,549
  • 15
  • 193
  • 205
  • I just needed this confirmation, so we cannot use the current ADO.NET Provider we have, resulting in the fact we'll have to take a step back to ASP.NET MVC 5 for now until they retarget the .NET 4.5 Framework. Or do you see another solution to be able to use Entity Framework.. or use NHibernate but that might be even worse than stepping down for now. – rfcdejong Feb 19 '16 at 12:53
  • @rfcdejong: EntityFramework 6.x should work with 4.5.x, NHinerbate dunno. Multitargeting is just useful for libraries/packages – Tseng Feb 19 '16 at 12:55
  • Pervasive didn't wrote a EF6 provider, always being years behind. Just like their latest provider from last month this year is referencing .NET Framework v2.0 it seems. – rfcdejong Feb 19 '16 at 12:57