Giter Site home page Giter Site logo

Comments (9)

sdanyliv avatar sdanyliv commented on May 18, 2024 1

Will find time to convert FromSqlRaw. We have our own FromSql method. Just forgot to create transformation.

from linq2db.entityframeworkcore.

djkunkel avatar djkunkel commented on May 18, 2024 1

Thank you for this guidance. I was able to make my change in a custom override of TransformExpression!

from linq2db.entityframeworkcore.

djkunkel avatar djkunkel commented on May 18, 2024

I have a patch for this against version 2.0.5, do you accept pull requests? Also, I'm new to expression parsing and this project, so I may have done something terribly wrong, but I thought it might be helpful.

0001-Support-FromSql-when-using-FromRawSql-from-EF.txt

from linq2db.entityframeworkcore.

sdanyliv avatar sdanyliv commented on May 18, 2024

Which version of EF do you use?

from linq2db.entityframeworkcore.

djkunkel avatar djkunkel commented on May 18, 2024

3.1.3

from linq2db.entityframeworkcore.

sdanyliv avatar sdanyliv commented on May 18, 2024

I suggest to update to linq2db.EntityFrameworkCore 3.0 - it has a lot of improvements, especially Eager Loading.

Anyway, you can customize current integration before I fix that without changing library code:
Implement your new class MyImplementation derived from LinqToDBForEFToolsImplDefault and override TransformExpression method.
And assign it to LinqToDBForEFTools.Implementation = new MyImplementation()

Sorry a little bit busy now, I'll update library in several days. Your changes looks good, but I need to verify and create tests.

from linq2db.entityframeworkcore.

djkunkel avatar djkunkel commented on May 18, 2024

Thanks for your feedback. I initially tried to override the implementation as suggested, but the changes were to an inline method (LocalTransform) inside the TransformExpression method.

from linq2db.entityframeworkcore.

sdanyliv avatar sdanyliv commented on May 18, 2024

Hmm, strange, I thought that I have opened everything for customising. It should be easy, something like this:

public override Expression TransformExpression(Expression expression, IDataContext dc, DbContext ctx, IModel model)
{
   var expr = base.TransfromExpression(expression, dc, ctx, model);
   var expr = expr.Transform(e => {
      if ( e is MethodCallExpression and ... bla, bla is FromSqlRaw )
      {
         // your replace code
        return replaced;
      }
      return e;
   });

   return expr;
}

Anyway, will find a time to update library.

from linq2db.entityframeworkcore.

sdanyliv avatar sdanyliv commented on May 18, 2024

Released in 3.1.0

from linq2db.entityframeworkcore.

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.