zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
449 stars 86 forks source link

How to register a type for DbSet.Execute() #123

Closed MichaelKastl closed 2 years ago

MichaelKastl commented 2 years ago

I'm attempting to use DbFunctions classes inside an Exeute() method on a DbSet in an EF6 DbContext. I get an error stating that no applicable member has been found for the expression. I've tried using

EvalManager.DefaultContext.RegisterType(typeof(DbFunctions)) 

to register it, but that gives me a NullRef exception with no hints as to what's actually returning as null. Can I not register types for this particular method, or am I misunderstanding the documentation?

EDIT: This was not a library problem, the NullRef was coming from my query itself. Registering the DbFunctions type and then editing my query fixed my issue.