using System; using System.Collections.Generic; using System.Text; using Esiur.Core; using Esiur.Data; using Esiur.Resource.Template; namespace Esiur.Resource; public abstract class Store : IStore where T : IResource { public Instance Instance { get; set; } public event DestroyedEvent OnDestroy; public abstract AsyncReply AddChild(IResource parent, IResource child); public abstract AsyncReply AddParent(IResource child, IResource parent); public abstract AsyncBag Children(IResource resource, string name) where T1 : IResource; public virtual void Destroy() { OnDestroy?.Invoke(this); } public abstract AsyncReply Get(string path); public abstract AsyncReply> GetRecord(IResource resource, DateTime fromDate, DateTime toDate); public abstract string Link(IResource resource); public abstract bool Modify(IResource resource, string propertyName, object value, ulong age, DateTime dateTime); public abstract AsyncBag Parents(IResource resource, string name) where T1 : IResource; public abstract AsyncReply Put(IResource resource); public abstract bool Record(IResource resource, string propertyName, object value, ulong age, DateTime dateTime); public abstract bool Remove(IResource resource); public abstract AsyncReply RemoveChild(IResource parent, IResource child); public abstract AsyncReply RemoveParent(IResource child, IResource parent); public abstract AsyncReply Trigger(ResourceTrigger trigger); public async AsyncReply New(string name = null, object attributes = null, object properties = null) { var resource = await Warehouse.New(name, this, null, null, attributes, properties); resource.Instance.Managers.AddRange(this.Instance.Managers.ToArray()); return resource; } }