2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 05:23:13 +00:00
This commit is contained in:
2023-07-01 15:32:23 +03:00
parent 7ce0037e40
commit b6f5a8d9dd
12 changed files with 73 additions and 27 deletions

View File

@ -47,6 +47,10 @@ public static class EsiurExtensions
//}
public static DbSet<object> SetByType(this DbContext context, Type t)
{
return (DbSet<object>)context.GetType().GetMethod("Set").MakeGenericMethod(t).Invoke(context, new object[0]);
}
public static T AddResource<T>(this DbSet<T> dbSet, T resource) where T : class, IResource
=> AddResourceAsync(dbSet, resource).Wait();