lko
lko

Reputation: 8299

ASP.NET 5 NHibernate Session needs System.Data.IDbConnection?

How can I resolve a dependency in a vNext ASP.NET 5 project? When I try add a dependency in the project.json it cannot find System.Data.

I'm trying to close an NHibernate 4 ISession with Session.Close().

try
{
    _transaction.Rollback();
}
finally
{
    Session.Close(); // Compiler error
}

The type 'IDbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Upvotes: 2

Views: 1092

Answers (1)

lko
lko

Reputation: 8299

I got it to compile by adding the dependency, which doesn't exist in ASP.NET 5.0, to the project.json.

"frameworks": {
    "aspnet50": {
        "frameworkAssemblies": {
            // Stuff in the global assembly cache(.net assemblies etc.)
            "System.Data" : "4.0.0.0" 
        }
    }
}

(I assume it works, my project isn't ready to test it out).

For more info on the new project and adding references and dependencies see the overview on ASP.NET 5.0.

Upvotes: 2

Related Questions