I'm having trouble getting a specific value into the Untis_Prof
field.
Code Sample:
foreach (EnseignantReport test in grades)
{
test.Untis_Prof = this._dbContext.Teachers.FirstOrDefaultAsync(c =>
test.Untis_Prof == string.Join(" ", new[] {c.LastName, c.FirstName }))
.Result.UntisCode;
}
Error:
System.InvalidOperationException: The LINQ expression
'DbSet<Teacher>()
.Where(t => __progress_EnteringTeacherName_0 == string.Format(
format: "{0} {1}",
arg0: t.LastName,
arg1: t.FirstName))'
could not be translated. Additional information: Translation of method'string.Format'
failed. If this method can be mapped to your custom function, see https://go.microsoft.com/fwlink/?linkid=2132413 for more information. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
at
Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.g__CheckTranslated|15_0(ShapedQueryExpression translated, <>c__DisplayClass15_0& )
at
Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
Can someone help me?