From f8b70d1ea6e5265aa72d6a45ae999eacc53f35e8 Mon Sep 17 00:00:00 2001 From: Ahmed Zamil Date: Wed, 11 Jan 2023 16:09:16 +0300 Subject: [PATCH] gen --- Esiur.Analysis.Test/Program.cs | 4 ++-- Esiur.Stores.EntityCore/EntityStore.cs | 21 ++++++++++++++++++++- Esiur/Proxy/ResourceGenerator.cs | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Esiur.Analysis.Test/Program.cs b/Esiur.Analysis.Test/Program.cs index 127cef6..39f078b 100644 --- a/Esiur.Analysis.Test/Program.cs +++ b/Esiur.Analysis.Test/Program.cs @@ -39,8 +39,8 @@ namespace Esiur.Analysis.Test [STAThread] static void Main() { - var signalA = new double[] { 1, 1, 1, V, 1, 1, V, V, 1, V, 1, V, V, V, V }; - var signalB = new double[] { 1, V, V, V, V, 1, V, V, V, V, 1, V, V, V, V }; + var signalA = new double[] { V,1, V, 1 , V, V, V }; + var signalB = new double[] { V, V, 1, V, V, 1, V }; var cor = signalA.CrossCorrelation(signalB, true); Debug.WriteLine(cor); diff --git a/Esiur.Stores.EntityCore/EntityStore.cs b/Esiur.Stores.EntityCore/EntityStore.cs index a8ae58e..4f81e9e 100644 --- a/Esiur.Stores.EntityCore/EntityStore.cs +++ b/Esiur.Stores.EntityCore/EntityStore.cs @@ -71,6 +71,11 @@ public class EntityStore : IStore foreach (var rf in ent.References) rf.Load(); + foreach(var nav in ent.Navigations) + nav.Load(); + + //var refs = ent.References.ToList(); + return new AsyncReply(res as IResource); } @@ -158,7 +163,21 @@ public class EntityStore : IStore public bool Remove(IResource resource) { - throw new NotImplementedException(); + var type = ResourceProxy.GetBaseType(resource); + + var eid = TypesByType[type].PrimaryKey.GetValue(resource); + + lock (DBLock) + { + if (DB[type].ContainsKey(eid)) + { + DB[type].Remove(eid); + return true; + } + } + + return false; + //throw new NotImplementedException(); } public AsyncReply AddChild(IResource parent, IResource child) diff --git a/Esiur/Proxy/ResourceGenerator.cs b/Esiur/Proxy/ResourceGenerator.cs index 9e8fb3f..d6bc033 100644 --- a/Esiur/Proxy/ResourceGenerator.cs +++ b/Esiur/Proxy/ResourceGenerator.cs @@ -182,7 +182,7 @@ namespace { ci.ClassSymbol.ContainingNamespace.ToDisplayString() } {{ // copy attributes var attrs = string.Join("\r\n\t", f.GetAttributes().Select(x => $"[{x.ToString()}]")); - code += $"\t{attrs}\r\n\t public {f.Type} {pn} {{ \r\n\t\t get => {fn}; \r\n\t\t set {{ \r\n\t\t {fn} = value; \r\n\t\t Instance?.Modified(); \r\n\t\t}}\r\n\t}}\r\n"; + code += $"\t{attrs}\r\n\t public {f.Type} {pn} {{ \r\n\t\t get => {fn}; \r\n\t\t set {{ \r\n\t\t this.{fn} = value; \r\n\t\t Instance?.Modified(); \r\n\t\t}}\r\n\t}}\r\n"; } code += "}}\r\n";