2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33: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

@ -770,11 +770,16 @@ namespace Esiur.Net.IIP
// create the resource
var resource = Activator.CreateInstance(type, args) as IResource;
Warehouse.Put(resource, name, store as IStore, parent);
Warehouse.Put(resource, name, store as IStore, parent).Then(ok =>
{
SendReply(IIPPacket.IIPPacketAction.CreateResource, callback)
.AddUInt32(resource.Instance.Id)
.Done();
SendReply(IIPPacket.IIPPacketAction.CreateResource, callback)
.AddUInt32(resource.Instance.Id)
.Done();
}).Error(x =>
{
SendError(ErrorType.Exception, callback, (ushort)ExceptionCode.AddToStoreFailed);
});
});
});
@ -1959,14 +1964,27 @@ namespace Esiur.Net.IIP
{
// ClassId, ResourceAge, ResourceLink, Content
if (resource == null)
Warehouse.Put(dr, id.ToString(), this, null, tmp);
Codec.ParsePropertyValueArray((byte[])rt[3], this).Then((ar) =>
{
dr._Attach(ar);
resourceRequests.Remove(id);
reply.Trigger(dr);
});
Warehouse.Put(dr, id.ToString(), this, null, tmp).Then((ok) =>
{
Codec.ParsePropertyValueArray((byte[])rt[3], this).Then((ar) =>
{
dr._Attach(ar);
resourceRequests.Remove(id);
reply.Trigger(dr);
});
}).Error(ex=>reply.TriggerError(ex));
}
else
{
Codec.ParsePropertyValueArray((byte[])rt[3], this).Then((ar) =>
{
dr._Attach(ar);
resourceRequests.Remove(id);
reply.Trigger(dr);
}).Error(ex=>reply.TriggerError(ex));
}
}).Error((ex) =>
{
reply.TriggerError(ex);