Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to call scalar function #827

Open
mmisnerms opened this issue Jan 12, 2024 · 0 comments
Open

Unable to call scalar function #827

mmisnerms opened this issue Jan 12, 2024 · 0 comments

Comments

@mmisnerms
Copy link

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)
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant