0
omital created
Hi, I think that method "AddLanguageIfNotExists" in template with this code
private void AddLanguageIfNotExists(ApplicationLanguage language)
{
if (_context.Languages.Any(l => l.TenantId == language.TenantId && l.Name == language.Name))
{
return;
}
_context.Languages.Add(language);
_context.SaveChanges();
}
must be
private void AddLanguageIfNotExists(ApplicationLanguage language)
{
if (_context.Languages.Any(l => (l.TenantId == language.TenantId || (l.TenantId.HasValue==false && language.TenantId.HasValue==false)) && l.Name == language.Name))
{
return;
}
_context.Languages.Add(language);
_context.SaveChanges();
}
2 Answer(s)
-
0
This is not needed since EF should automatically do it. There was a bug in EF dynamicfilters which causes this exception and we downgraded it: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1209">https://github.com/aspnetboilerplate/as ... ssues/1209</a>
-
0
Thank you for your response.