public void LoadData() { if (!DataLoaded) { if (EntitiesId != null && EntitiesId.Length > 0) { this.DataLoaded = true; //Call for get entities by ids. OdooCommandContext context = new OdooCommandContext(); context.EntityName = OdooCommandContextFactory.GetOdooEntityName(typeof(T)); ResultSet result = this.Service.GetEntityCommand(context, this.EntitiesId); OdooObjectFactory.BuildEntities <T>(Service, result, this); } } }
internal IEnumerable <T> GetEntities <T>(Expression <Func <T, bool> > conditions, int?offset = null, int?limit = null, string order = null) where T : IOdooObject, new() { try { OdooCommandContext context; context = OdooCommandContextFactory.BuildCommandContextFromExpression <T>(conditions); context.Limit = limit ?? 0; context.Offset = offset ?? 0; context.Order = order; IEnumerable <object> ids = SearchCommand(context); context.ClearArguments(); ResultSet result = GetEntityCommand(context, ids); IEnumerable <T> entities = OdooObjectFactory.BuildEntities <T>(this, result); return(entities); } catch (Exception ex) { return(null); } }
private void LoadData() { if (!_dataLoaded) { var context = new OdooCommandContext(); context.EntityName = OdooCommandContextFactory.GetOdooEntityName(typeof(T)); var result = _service.GetEntityCommand(context, new List <object> { _id }); var collection = new Collection <T>(); OdooObjectFactory.BuildEntities(_service, result, collection); if (collection.Any()) { @object = collection.First(); } } }