2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-26 21:13:13 +00:00
This commit is contained in:
2021-05-14 18:24:34 +03:00
parent 0af14009be
commit 5bf258673d
48 changed files with 1032 additions and 383 deletions

View File

@ -20,7 +20,7 @@ namespace Esiur.Stores
public void Destroy()
{
OnDestroy?.Invoke(this);
}
public string Link(IResource resource)
@ -41,14 +41,14 @@ namespace Esiur.Stores
return new AsyncReply<IResource>(null);
}
public async AsyncReply<bool> Put(IResource resource)
public AsyncReply<bool> Put(IResource resource)
{
resources.Add(resource.Instance.Id, resource);// new WeakReference<IResource>(resource));
resource.Instance.Variables["children"] = new AutoList<IResource, Instance>(resource.Instance);
resource.Instance.Variables["parents"] = new AutoList<IResource, Instance>(resource.Instance);
return true;
return new AsyncReply<bool>(true);
}
public AsyncReply<IResource> Retrieve(uint iid)

View File

@ -20,6 +20,7 @@ namespace Esiur.Stores
public void Destroy()
{
OnDestroy?.Invoke(this);
}
@ -31,19 +32,19 @@ namespace Esiur.Stores
return null;
}
public async AsyncReply<IResource> Get(string path)
public AsyncReply<IResource> Get(string path)
{
foreach (var r in resources)
if (r.Value.IsAlive && (r.Value.Target as IResource).Instance.Name == path)
return r.Value.Target as IResource;
return new AsyncReply<IResource>(r.Value.Target as IResource);
return null;
return new AsyncReply<IResource>(null);
}
public async AsyncReply<bool> Put(IResource resource)
public AsyncReply<bool> Put(IResource resource)
{
resources.Add(resource.Instance.Id, new WeakReference( resource));// new WeakReference<IResource>(resource));
return true;
return new AsyncReply<bool>(true);
}
public AsyncReply<IResource> Retrieve(uint iid)