EntityFramework-Reverse-POCO-Code-First-Generator icon indicating copy to clipboard operation
EntityFramework-Reverse-POCO-Code-First-Generator copied to clipboard

Unable to call scalar function

Open mmisnerms opened this issue 2 years ago • 0 comments

I am attempting to use a scalar function in a LINQ to entities query.

The tt file is generating an instance method and when I attempt to use it throws the "Don't call this directly. Use LINQ to call the scalar valued function as part of your query" exception. var a = from s in db.Users where s.LastName == "lastname" select new { email = s.Email, number = db.is4_fnScalarValue2(1) };

I changed the method to static and removed from the interface and it is working now.

var a = from s in db.Users where s.LastName == "lastname" select new { email = s.Email, number = ApplicationDbContext.is4_fnScalarValue2(1) };

mmisnerms avatar Jan 12 '24 14:01 mmisnerms