-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for netcoreapp1.0 #7
Comments
I didn't think EF6 supported NetCore, does it? It's .NET 4.5 only. |
Strike that, .NET 4.0 and .NET 4.5. What EF are you using? |
I'm using EF Core, but this had been working. Here's the scenario: I have an ASP.NET Core project (created prior to the 1.0 release) that was using AutoMapper 5.0.0-beta-1 and AutoMapper.EF6 0.3.0. Everything worked as expected. I've since upgraded that project to .NET Core 1.0 release and updated to AutoMapper 5.0.0. I can't use any of the AutoMapper.EF6 versions now since they don't support the netcoreapp1.0 profile. I tried to see if I could get a version compiling against that profile, but the DelegateDecompiler.EntityFramework dependency is very old and doesn't currently support any of the .NET Core stuff. (It was last updated about 6 months ago.) If this is intended only for EF6 and not EF Core, is there a similar package for EF Core? |
It had been working? Maybe when EF Core was EF7, but I never had a package working with EF Core. The problem with Delegate Decompiler is it relies on reflection tools that are currently ONLY available to full .NET Framework. The APIs simply do not exist in .NET Core, neither do the capabilities. |
Yes, it had been working. :) Keep in mind, though, that this was prior to the change to using netcoreapp1.0 as the moniker, so that may have had something to do with it. I saw that issue with Delegate Decompiler as well, which prevents it from being used at all. In the meantime (only tested with a couple of methods), it seems like I can create a workaround by doing this: public static class EntityFrameworkExtensions
{
public static async Task<List<TDestination>> ProjectToListAsync<TDestination>(this IQueryable queryable, IConfigurationProvider config)
{
return await queryable.ProjectTo<TDestination>(config).ToListAsync();
}
public static async Task<TDestination> ProjectToSingleOrDefaultAsync<TDestination>(this IQueryable queryable, IConfigurationProvider config)
{
return await queryable.ProjectTo<TDestination>(config).SingleOrDefaultAsync();
}
public static TDestination ProjectToSingleOrDefault<TDestination>(this IQueryable queryable, IConfigurationProvider config)
{
return queryable.ProjectTo<TDestination>(config).SingleOrDefault();
}
public static List<TDestination> ProjectToList<TDestination>(this IQueryable queryable, IConfigurationProvider config)
{
return queryable.ProjectTo<TDestination>(config).ToList();
}
} I've been able to test both the async and the non-async versions and they both seem to work. Not sure if there might be any potential issues with that approach though. |
One way to get this to work would be to only support net451 (which EF Core does support) and not netstandard1.3, its other target. |
Also, the delegate decompiler stuff works with .NET 4.5. So if you didn't want to run on .NET Core, you're set. Which, if you are.....good luck buddy :) |
One last thing, the delegate decompiler EF extension was for async, which doesn't sound like it should be used ATM dotnet/efcore#5816 so I could create and EF core version that uses delegate decompile and targets .NET 4.5.1. Thoughts? It's such a silly little library though, just extension methods. |
Yea, it's probably not worth the effort. Do you see anything wrong with the extension methods I showed in this comment? The two (only because those were the two I was previously using) I've tested so far seem to work correctly. |
Nope. The extension methods were pretty simple, just stuff we copied and pasted around. |
Cool. I'll add the rest of them in so I can keep using them. |
Having read through this issue; am I correct that if you used EF core in a 4.5/4.6.1 [not .net core] app then the automapper.EF6 lib will probably work? |
Worth a shot, but the underlying dependency I have is on EF6 not EF Core On Wednesday, October 5, 2016, Darcy notifications@github.com wrote:
|
When trying to install in an ASP.NET Core 1.0 project with AutoMapper v5.0.0 installed, AutoMapper.EF6 fails to restore with the following error:
The text was updated successfully, but these errors were encountered: