diff --git a/Esiur.Stores.EntityCore/EntityStore.cs b/Esiur.Stores.EntityCore/EntityStore.cs index 4f81e9e..cf2f8fc 100644 --- a/Esiur.Stores.EntityCore/EntityStore.cs +++ b/Esiur.Stores.EntityCore/EntityStore.cs @@ -66,6 +66,16 @@ public class EntityStore : IStore var db = Getter(); var res = db.Find(ti.Type.ClrType, id); + if (res == null) + { + return new AsyncReply(null); + + //var rt = new AsyncReply(); + //rt.TriggerError(new AsyncException(ErrorType.Management, + // (ushort)ExceptionCode.ResourceNotFound, "Resource not found.")); + //return rt; + } + // load navigation properties var ent = db.Entry(res); foreach (var rf in ent.References) @@ -202,7 +212,7 @@ public class EntityStore : IStore public AsyncBag Children(IResource resource, string name) where T : IResource { - throw new NotImplementedException(); + return new AsyncBag(null); } public AsyncBag Parents(IResource resource, string name) where T : IResource diff --git a/Esiur/Resource/Warehouse.cs b/Esiur/Resource/Warehouse.cs index 4a7f839..00e25ac 100644 --- a/Esiur/Resource/Warehouse.cs +++ b/Esiur/Resource/Warehouse.cs @@ -396,7 +396,7 @@ public static class Warehouse for (var i = 1; i < p.Length; i++) { var children = await resource.Instance.Children(p[i]); - if (children.Length > 0) + if (children != null && children.Length > 0) { if (i == p.Length - 1) return children;