Base solution for your next web application
Open Closed

EntityFrameworkExtension #5639


User avatar
0
buddhit created

Hi there

We have got new version of AspNetZero that is no longer has EntityFrameworkExtension on EntityFrameworkCore. Is there any reason this has been removed. What is alternet way to query raw sql ??

Regards Buddhi


5 Answer(s)
  • User Avatar
    1
    ismcagdas created
    Support Team
  • User Avatar
    0
    buddhit created

    Hi there,

    I know that bit, but priviously we used to have EntityFrameworkExtension class with WithSqlParam method that used to inject params for the query. My question is : Is there any reason that extension is removed ??

    Regards Buddhi

  • User Avatar
    0
    ryancyq created
    Support Team

    Which version of AspNetZero you upgraded from/to?

    Did you use EFCore-FluentStoredProcedure for WithSqlParam()previously?

  • User Avatar
    0
    buddhit created

    Hi there

    We have two sperate apps one uses ASPNETZERO 5.5 and another one use 5.6.2. on the 5.5 we have have EntityFrameworkExtension class with WithSqlParam but on the 5.6.2 we cant find have EntityFrameworkExtension class.

     public async Task<int> DeleteDormantRecord(long ppmId)
            {
                EnsureConnectionOpen();
                const string sql = @"delete from Dormantrecords where ppmId = @id";
    
                using (var command = CreateCommand(sql, _transactionProvider, CommandType.Text))
                {
                    var com = command.WithSqlParam("id", ppmId);
    
                    return await com.ExecuteNonQueryAsync();
                }
            }
    

    This is how we used WithSqlParam from extension class on the V5.5.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @buddhit

    EntityFrameworkExtension is not created by us. Probably you have added it into your project.