EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
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)
};
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) };