diff --git a/odb/ng/Mapper.API.cs b/odb/ng/Mapper.API.cs index 240aa5d..717e488 100644 --- a/odb/ng/Mapper.API.cs +++ b/odb/ng/Mapper.API.cs @@ -23,7 +23,16 @@ namespace ln.types.odb.ng { return new MappedObjectEnumeration(this, type, GetDocumentIDs(type),refresh); } - + public object[] LoadArray(Type type) => LoadArray(type, false); + public object[] LoadArray(Type type, bool refresh) + { + MappedObjectEnumeration mappedObjectEnumeration = new MappedObjectEnumeration(this, type, GetDocumentIDs(type), refresh); + object[] objects = new object[mappedObjectEnumeration.Count]; + int n = 0; + foreach (object o in mappedObjectEnumeration) + objects[n++] = o; + return objects; + } public T Load(Guid documentID) => (T)Load(typeof(T), documentID, false); public T Load(Guid documentID,bool refresh) => (T)Load(typeof(T), documentID, refresh); public object Load(Type type, Guid documentID) => Load(type, documentID, false); @@ -40,7 +49,6 @@ namespace ln.types.odb.ng } else { - IStorage storage = StorageContainer.GetStorage(type.FullName); Document document = storage.Load(documentID); @@ -190,6 +198,8 @@ namespace ln.types.odb.ng IEnumerable documentIDs; bool refresh; + public int Count => documentIDs.Count(); + public MappedObjectEnumeration(Mapper mapper,Type type,IEnumerable documentIDs,bool refresh) { this.mapper = mapper;