2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-26 21:13:13 +00:00

async put

This commit is contained in:
2021-02-20 21:55:11 +03:00
parent 7c707637de
commit 4cfad2a242
6 changed files with 58 additions and 47 deletions

View File

@ -48,7 +48,7 @@ namespace Esiur.Stores.MongoDB
IMongoDatabase database;
IMongoCollection<BsonDocument> resourcesCollection;
Dictionary<string, WeakReference> resources = new Dictionary<string, WeakReference>();
KeyList<string, WeakReference> resources = new KeyList<string, WeakReference>();
[Public]
@ -158,7 +158,8 @@ namespace Esiur.Stores.MongoDB
else
resources.Add(id, new WeakReference(resource));
Warehouse.Put(resource, document["name"].AsString, this);
//@TODO this causes store.put to be invoked, need fix
await Warehouse.Put(resource, document["name"].AsString, this);
var parents = document["parents"].AsBsonArray;

View File

@ -36,9 +36,9 @@ namespace Esiur.Stores.MongoDB
public class MongoDBStore<T> : MongoDBStore where T:IResource
{
[Public]
public T New(string name = null, object properties = null)
public async AsyncReply<T> New(string name = null, object properties = null)
{
var resource = Warehouse.New<T>(name, this, null, null, null, properties);
var resource = await Warehouse.New<T>(name, this, null, null, null, properties);
resource.Instance.Managers.AddRange(this.Instance.Managers.ToArray());
return resource;
}