none
Type Provider SqlEntityConnection and EF 6 Async RRS feed

  • Question

  • I'm (cross)posting an unanswered question from stackoverflow here:

    (from the post)
    Is there any way to use the SqlEntityConnection Type Provider with the async features introduced in Entity Framework 6? The type provider itself seems to work well enough with EF 6, but I'm not seeing any way to access any of the async methods. Am I missing something, or does anyone know if there are plans to add async support to the type provider?

    (my own observations)
    I've confirmed that trying to use the ToListAsync extension method throws an InvalidOperationException "The source IQueryable doesn't implement IDbAsyncEnumerable<System.String>."

    I'd love to hear if there's plans from Microsoft on this.

    Monday, March 24, 2014 8:03 AM

Answers

  • Hi,

    >>I strongly suspect that whichever team that created the F# SqlEntityConnection Type Prodiver will have to update it to use EF 6 to enable the usage of LINQ-to-Entites Async methods.

    For this, what we can do is to post a wish for EF and let the team know to there and vote it.

    http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by cjstevenson Monday, March 31, 2014 10:19 PM
    Monday, March 31, 2014 9:22 AM
    Moderator

All replies

  • Hello,

    I do not sure whether the EF team has support these async methods in the provider, but for the error “System.InvalidOperationException : The source IQueryable doesn't implement

     IDbAsyncEnumerable...", you can check below way:

    Because Entity Framework queries make use of LINQ, the extension methods are defined on IQueryable and IEnumerable. However, because they are only designed to be used with Entity Framework we may receive the following error if we try to use them on a LINQ query that isn’t an Entity Framework query.

    Whilst the async methods are only supported when running against an EF query, we may want to use them in we unit test when running against an in-memory test double of a DbSet.

    For how to achieve this scenario see the 'Testing with async queries' section in links below, in order to use the async methods we need to create an in-memory DbAsyncQueryProvider to process the async query:

    http://msdn.microsoft.com/en-us/data/dn314429#async

    If it does not work in that provider, I think the provider team may not implement these async methods. Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 25, 2014 10:05 AM
    Moderator
  • Hmm. As far as I can tell, the SqlEntityConnection Type Provider doesn't have a way to mock the context object. The type provider isn't generating F# code , it's directly inserting IL code to access the database via EF. I believe it's using the same technique that EF 5 Code First uses, but instead of reflecting through metadata, it is querying the database directly to generate the (pseudo) ObjectContext.

    Here's a little background: creating an f# type provider than can be used from c#.

    I strongly suspect that whichever team that created the F# SqlEntityConnection Type Prodiver will have to update it to use EF 6 to enable the usage of LINQ-to-Entites Async methods.

    Monday, March 31, 2014 8:26 AM
  • Hi,

    >>I strongly suspect that whichever team that created the F# SqlEntityConnection Type Prodiver will have to update it to use EF 6 to enable the usage of LINQ-to-Entites Async methods.

    For this, what we can do is to post a wish for EF and let the team know to there and vote it.

    http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by cjstevenson Monday, March 31, 2014 10:19 PM
    Monday, March 31, 2014 9:22 AM
    Moderator
  • Thanks for finding that link. I've have the feature suggestion: http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/5707604-updating-the-f-sqlentityconnection-type-provider
    Monday, March 31, 2014 10:19 PM