public EntityResult <T> GetEntities <T>(List <int> ids, UserAccess access, Paging paging = null) where T : TreeRecord, new() { var metaOptions = new EntityMetaOptions { FetchAncestors = false, FetchChildren = true, ChildrenPaging = paging }; var found = elasticService.QueryForIds <T>(ids, access, new Paging { Take = ElasticService.ELASTIC_SEARCH_HIT_LIMIT, Skip = 0 }); var result = CreateEntitiesResult(access, null, found, metaOptions); return(result); }
public Entity <T> GetEntity <T>(int id, UserAccess access, Paging paging = null) where T : TreeRecord, new() { var metaOptions = new EntityMetaOptions { FetchAncestors = true, FetchChildren = true, ChildrenPaging = paging }; var found = elasticService.QueryForId <T>(id, access); var result = found.Exception == null ? CreateEntityResult(access, found, metaOptions) : null; return(result); }
public Entity <T> CreateEntityResult <T>(UserAccess access, ElasticQueryResult <T> found, EntityMetaOptions metaOptions) where T : TreeRecord, new() { var entity = GetResultAsEntities(access, found, metaOptions); return(entity?.FirstOrDefault()); }
public EntityResult <T> CreateEntitiesResult <T>(UserAccess access, Paging paging, ElasticQueryResult <T> found, EntityMetaOptions metaOptions) where T : TreeRecord, new() { var result = new EntityResult <T>(); if (found.Exception != null) { return(result); } var entities = GetResultAsEntities(access, found, metaOptions); result.Items = entities; if (paging != null) { result.Paging = paging; } return(result); }
public List <Entity <T> > GetResultAsEntities <T>(UserAccess access, ElasticQueryResult <T> result, EntityMetaOptions options = null) where T : TreeRecord, new() { var entities = result?.Entries ?? new List <Entity <T> >(); var decorator = new EntityDecorator <T>(elasticService, elasticSettings, this, modelData); foreach (var entity in entities) { entity.Context = decorator.GetAsDecoratedContext(entity, access, options); } return(entities); }