1234567891011121314151617181920212223 |
- using System;
- using System.Linq.Expressions;
- using System.Reflection;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Query.Expressions;
- using Microsoft.EntityFrameworkCore.Query.ExpressionTranslators;
-
- namespace Luticate2.Utils.DataAccess.Npgsql
- {
- public class NpgsqlStoredProcTranslator : IMethodCallTranslator
- {
- private readonly Type _declaringType = typeof(DbContext);
-
- public Expression Translate(MethodCallExpression methodCallExpression)
- {
- if (_declaringType.IsAssignableFrom(methodCallExpression.Method.DeclaringType))
- {
- return new SqlFunctionExpression(methodCallExpression.Method.Name, methodCallExpression.Type, methodCallExpression.Arguments);
- }
- return null;
- }
- }
- }
|