mirror of
https://github.com/yawaflua/yaflay.ru.git
synced 2026-02-05 03:14:12 +02:00
make backend for my site
This commit is contained in:
13
Utilities/AppDbContextUtilities.cs
Normal file
13
Utilities/AppDbContextUtilities.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace yawaflua.ru.Utilities
|
||||
{
|
||||
public static class AppDbContextUtilities
|
||||
{
|
||||
public static bool TryGetValue<T>(this DbSet<T> set, Func<T, bool> predicate, out T? value) where T : class
|
||||
{
|
||||
value = set.FirstOrDefault(predicate);
|
||||
return value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user