Giter VIP home page Giter VIP logo

Comments (13)

jbogard avatar jbogard commented on June 23, 2024

I didn't think EF6 supported NetCore, does it? It's .NET 4.5 only.

from automapper.ef6.

jbogard avatar jbogard commented on June 23, 2024

Strike that, .NET 4.0 and .NET 4.5. What EF are you using?

from automapper.ef6.

scottdorman avatar scottdorman commented on June 23, 2024

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?

from automapper.ef6.

jbogard avatar jbogard commented on June 23, 2024

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.

from automapper.ef6.

scottdorman avatar scottdorman commented on June 23, 2024

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.

from automapper.ef6.

jbogard avatar jbogard commented on June 23, 2024

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.

from automapper.ef6.

jbogard avatar jbogard commented on June 23, 2024

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 :)

from automapper.ef6.

jbogard avatar jbogard commented on June 23, 2024

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.

from automapper.ef6.

scottdorman avatar scottdorman commented on June 23, 2024

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.

from automapper.ef6.

jbogard avatar jbogard commented on June 23, 2024

Nope. The extension methods were pretty simple, just stuff we copied and pasted around.

from automapper.ef6.

scottdorman avatar scottdorman commented on June 23, 2024

Cool. I'll add the rest of them in so I can keep using them.

from automapper.ef6.

darcythomas avatar darcythomas commented on June 23, 2024

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?

from automapper.ef6.

jbogard avatar jbogard commented on June 23, 2024

Worth a shot, but the underlying dependency I have is on EF6 not EF Core

On Wednesday, October 5, 2016, Darcy [email protected] wrote:

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?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#7 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAGYMp2wI8xqjt-N-WAnyLGWSAb6ouDgks5qxHOYgaJpZM4JDGTN
.

from automapper.ef6.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.