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)
-
1
Hi,
You can create a custom repository https://aspnetboilerplate.com/Pages/Documents/Repositories#custom-repositories and the run raw sql query you want https://docs.microsoft.com/en-us/ef/core/querying/raw-sql
-
0
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
-
0
Which version of AspNetZero you upgraded from/to?
Did you use EFCore-FluentStoredProcedure for
WithSqlParam()
previously? -
0
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.
-
0
Hi @buddhit
EntityFrameworkExtension is not created by us. Probably you have added it into your project.