3 ms·
In C#, there is Linq to SQL. Linq to SQL is an ORM. It does SQL code generation, even from user-provided code as long as it is in Linq Expressions form. With
by Dwedit 1y ago
In C#, there is Linq to SQL. Linq to SQL is an ORM. It does SQL code generation, even from user-provided code as long as it is in Linq Expressions form.
With DelegateDecompiler, you can turn native lambdas into Linq Expressions. (You just need to re-wrap the decompiled method body to remove the extra "this" parameter from the lambda). With this, you can write C# code, and it will generate SQL code.
- mrkeen 1y agoYou just defined ORMs and made no comment on consistency. And Linq is what prompted me to write the comment. In this EF code, we're deducting an amount from some balance, not necessarily the highest balance: // Find the highest balance var maxAccount = await db.MyAccounts.OrderByDescending(x => x.Balance).FirstAsync(); ... // Deduct an amount maxAccount.Balance -= amount; Whereas in SQL, it will work.