Add Mapper.Count, Mapper.LoadArray(..)
parent
f79bf14118
commit
52e63b40e0
|
@ -23,7 +23,16 @@ namespace ln.types.odb.ng
|
||||||
{
|
{
|
||||||
return new MappedObjectEnumeration(this, type, GetDocumentIDs(type),refresh);
|
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<T>(Guid documentID) => (T)Load(typeof(T), documentID, false);
|
public T Load<T>(Guid documentID) => (T)Load(typeof(T), documentID, false);
|
||||||
public T Load<T>(Guid documentID,bool refresh) => (T)Load(typeof(T), documentID, refresh);
|
public T Load<T>(Guid documentID,bool refresh) => (T)Load(typeof(T), documentID, refresh);
|
||||||
public object Load(Type type, Guid documentID) => Load(type, documentID, false);
|
public object Load(Type type, Guid documentID) => Load(type, documentID, false);
|
||||||
|
@ -40,7 +49,6 @@ namespace ln.types.odb.ng
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
IStorage storage = StorageContainer.GetStorage(type.FullName);
|
IStorage storage = StorageContainer.GetStorage(type.FullName);
|
||||||
Document document = storage.Load(documentID);
|
Document document = storage.Load(documentID);
|
||||||
|
|
||||||
|
@ -190,6 +198,8 @@ namespace ln.types.odb.ng
|
||||||
IEnumerable<Guid> documentIDs;
|
IEnumerable<Guid> documentIDs;
|
||||||
bool refresh;
|
bool refresh;
|
||||||
|
|
||||||
|
public int Count => documentIDs.Count();
|
||||||
|
|
||||||
public MappedObjectEnumeration(Mapper mapper,Type type,IEnumerable<Guid> documentIDs,bool refresh)
|
public MappedObjectEnumeration(Mapper mapper,Type type,IEnumerable<Guid> documentIDs,bool refresh)
|
||||||
{
|
{
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
|
|
Loading…
Reference in New Issue