Home

ASP.NET Core support

I am anxiously waiting for EF Core support in LINQPad. The description in Beta says that the support is there, and there is EF 7 (EF Core) driver, currently in version 1.0.1; however, as described here it just doesn't work. Any update on ETA? Not to sound bitter, but I convinced my boss to buy half-dozen copies for the team, but he is holding off since the use-case for just DB driver is quite limited...

Comments

  • Are you sure that the assemblies that you are asking LINQPad to use are compatible with the full .NET Framework?

    In other words, if you create a .NET Console app, can you reference your EF Core assemblies and use them?

    And if not, does the following help:
    https://github.com/dotnet/core/issues/89
  • I am struck with the same problem. I am working on Asp.net core RC2. I have downloaded the Entity Framework V7 driver as well, But after adding the "Microsoft.EntityFrameworkCore.dll" file in custom assembly i got a blank window for Typed Dbcontext. What am i doing wrong here.
  • edited September 2016
    @JoeAlbahari - I have no idea how I missed your response for 2+ weeks... didn't get any notifications :(

    Anyway - yes, I am pretty sure the assemblies are full ASP.NET Core assemblies. I don't think EF Core would work if I used more limited .NET Core - and I have no problems with the application itself. It's not .NET Console, but rather .NET Web Application, but I hope it doesn't matter.

    The problem is very easy to reproduce, and it's consistent! Create a sample .NET Core Web application, add EF Core (NuGet Microsoft.EntityFrameworkCore.SqlServer package), create EF classes (I created from DB by running Scaffold-DbContext) and compile. Then try to publish (to create DLLs, and reference resultant DLL from LinqPad). Get an error.

    Are you saying it works for you? Or there is a different scenario that works, and this scenario is not supported (yet)? We currently have Core 1.0 and will be upgrading to 1.0.1 this week if it matters...

    Thank you

    PS. I am not sure how the linked article would help me - I am not trying to use .NET 4.5 in any way... My framework setting is "netcoreapp1.0".
  • I upgraded to ASP.NET Core 1.0.1 and I am getting the same error:
    Cannot load assembly: 'Microsoft.AspNetCore.Mvc.ViewFeatures, Version=1.0.1.0
  • For what it's worth, v. 5.10 still has the same problem. Very strange that the snippet says "Full support for Entity Framework 7 (EF Core)".
  • Have you tried adding a netstandard or Framework46 build target to your .json file? Then it should generate assemblies that LINQPad can consume.
  • edited November 2016
    Maybe some additional guidance would be helpful... We are going with an assumption that it is ASP.NET Core application, right? (your reference to .json file is consistent with this assumption). Then what "build target" are you referring to? project.json has "frameworks" section, and the only one that is working in RTM and later is "netcoreapp1.0".

    I read in your comment elsewhere that Linqpad is .NET 4.6 application and can't read Core DLL. Maybe an example what *works* would answer all the questions. Most of us are smart kids - we can probably figure out how to use a working example in our own application :wink:
  • What works is that you can create a new .NET Framework 4.6 class library in Visual Studio, add NuGet references to EF7 ("EntityFramework.Core"), and then consume the library that you generated from LINQPad.

    However, if you generate a .NET Core project in Visual Studio or from the command-line (instead of a full .NET project), you won't be able to use the output assemblies in LINQPad. I appreciate that the situation is confusing.

    The underlying cause (as I understand), is that you cannot reference a .NET Core library from a .NET Framework application, because .NET Core is not a strict subset of .NET Framework; it relies on a *different* and incompatible runtime.

    As I alluded to previously, it seems (at least from reading the documentation and articles on the web) that it should be possible to create a .NET Core project, and then modify the project.json file and adding a build target so that it generates both netcore assemblies and full .NET (or "netstandard") assemblies that you can consume from a .NET application such as LINQPad. I've recently spent some time trying to get a working sample, but unfortunately without success. It's possible that someone else will have more luck (maybe some from Microsoft?)

    In terms of a proper solution, I hope that Microsoft will improve the situation in the future. It would be great if there was a way to reference NetCore assemblies from a full .NET Framework application. Perhaps one of the challenges is that there are types and methods in .NET Core that are not present in the .NET Framework. Could these be stubbed / NOP-ed, or they be implemented in a downloadable additional library?
  • Thank you. I understand. Unfortunately, it defeats the purpose - if I have to build a second application, separate from my real application - I may as well go straight to the database...
  • I have a similar problem, but I definitely built a .NET 4.5 lib. It says it wants to load EntityFrameworkCore.dll, but the library is called Microsoft.EntityFrameworkCore.dll. Is this a versioning issue?
  • John, you're right - it's a versioning issue. I will release a separate driver for EntityFrameworkCore 1.1.1 shortly.
  • Thanks, I'll be waiting!
  • Never came back here to say thanks, it did indeed work.
Sign In or Register to comment.