2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-09-13 12:43:17 +00:00
This commit is contained in:
2025-08-24 02:11:50 +03:00
parent 0d4ea04ef4
commit b12939e109
8 changed files with 149 additions and 79 deletions

View File

@@ -57,7 +57,8 @@ public static class EsiurExtensions
public static async AsyncReply<T> AddResourceAsync<T>(this DbSet<T> dbSet, T resource) where T : class, IResource
{
var store = dbSet.GetInfrastructure().GetService<IDbContextOptions>().FindExtension<EsiurExtensionOptions>().Store;
var options = dbSet.GetInfrastructure().GetService<IDbContextOptions>().FindExtension<EsiurExtensionOptions>();
var store = options.Store;
if (store == null)
throw new Exception("Store not set, please call 'UseEsiur' on your DbContextOptionsBuilder.");
@@ -89,7 +90,6 @@ public static class EsiurExtensions
foreach (var p in ps)
{
var mi = resType.GetMember(p.Key, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance)
.FirstOrDefault();
@@ -131,7 +131,7 @@ public static class EsiurExtensions
var id = store.TypesByType[typeof(T)].PrimaryKey.GetValue(resource);
await Warehouse.Put(id.ToString(), res, store, null, null, 0, manager);
await options.Warehouse.Put(id.ToString(), res, store, null, 0, manager);
return (T)res;
}