ASP.NET vNext refers to ADO.NET

I have a simple ASP.NET vNext class library project that cannot be compiled when types are referenced in System.Data; what did i do wrong here, or is there a problem in vnext?

I installed my .json project as follows:

{ "dependencies": { "System.Data.Common": "1.0.0-alpha3" }, "frameworks": { "net451": { "dependencies": { } }, "k10": { "dependencies": { } } } } 

When typing the "System.Data.Common" link, nuget intellisense worked fine; after saving the file, the package recovery occurred as expected.

Then I added an interface to the project that references System.Data.IDbConnection , for example:

 using System.Data; namespace MyProj.Common.Data { public interface IDbConnectionFactory { IDbConnection CreateConnection(); } } 

This bomb during assembly:

Error 1 The type or namespace name 'IDbConnection' could not be found (do you miss the use directive or assembly link?) C: \ Users \ Administrator \ Proj \ MyProj \ MyProj.Common \ Data \ IDbConnectionFactory.cs 7 9 MyProj.Common

My KVM list:

  C: \ Users \ Administrator \ Proj \ MyProj [next +3 ~ 2 -0!]> Kvm list

 Active Version Runtime Architecture Location Alias
 ------ ------- ------- ------------ -------- -----
   * 1.0.0-alpha3 svr50 x64 C: \ Users \ Administrator \ .kre \ packages default
        1.0.0-alpha3 svr50 x86 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha3 svrc50 x64 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha3 svrc50 x86 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha4-10364 CLR amd64 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha4-10364 CLR x86 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha4-10364 CoreCLR amd64 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha4-10364 CoreCLR x86 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha4-10365 CLR amd64 C: \ Users \ Administrator \ .kre \ packages
        1.0.0-alpha4-10365 CLR x86 C: \ Users \ Administrator \ .kre \ packages


 C: \ Users \ Administrator \ Proj \ MyProj [next +3 ~ 2 -0!]>

Can ASP.NET vNext use non-vNext links? the question seems very similar, but the error message here is slightly different, and nuget intellisense suggests that ADO.NET Packages are built for K10.

+5
source share
1 answer

IDbConnection is defined in System.Data.dll in the .NET desktop version. It is not included in System.Data.Common, which contains only a subset of the ADO.NET types that will be available in different versions of the runtime. If you are fine with the fact that your application only works with the .NET desktop computer, you should be able to reference the full version of System.Data.dll and use any of its types. If you want to target your CoreCLR-based production environment, you must stick to the types defined in System.Data.Common, for example. in this case you can use DbConnection.

+7
source

Source: https://habr.com/ru/post/1202302/


All Articles