我尝试调用存储在数据库中的标量函数。这是我的代码:
public class PronosticDbContext : DbContext
{
public PronosticDbContext(DbContextOptions<PronosticDbContext> options) : base(options)
{
}
[DbFunction(FunctionName = "GetPlayerPointsForDay", Schema = "dbo")]
public static int GetPlayerPointsForDay(int dayId, int userId) => throw new NotSupportedException();
}
Run Code Online (Sandbox Code Playgroud)
电话:
private IQueryable<PlayerRankingData> GetPlayerRanking(int? dayId)
{
return Context.Days.Where(x => x.Id == dayId.Value).Select(x => new PlayerRankingData
{
// Some properties
Users = x.Season.Users.Select(us => new PlayerRankingData.User
{
// Other properties
Last = PronosticDbContext.GetPlayerPointsForDay(x.Id, us.User.Id),
// Others again
}).OrderByDescending(u => u.Points).ThenByDescending(u => u.Last).ThenBy(u => u.Login)
});
}
Run Code Online (Sandbox Code Playgroud)
我不明白为什么,但我总是去NotSupportedException,我的标量函数从未被调用。为什么我错过了? …
好的,我有一个我不明白的问题.
我有一个布尔值,我测试,如果true我做了什么.但即使var是,javascript也永远不会进入true.
我试试这个:
if(isConfigD)
handleConfigurationD;
Run Code Online (Sandbox Code Playgroud)
这个 :
if(isConfigD == true)
handleConfigurationD;
Run Code Online (Sandbox Code Playgroud)
还有这个 :
if(isConfigD === true)
handleConfigurationD;
Run Code Online (Sandbox Code Playgroud)
但没有任何工作,而isConfigD总是设置true:(
我错过了什么?