public IEnumerable <TEntity> SearchAndRead(RpcFilter filter) { var entitesObject = connection.SearchAndRead(model, filter.ToArray(), propertiesName).ToXmlRpcStructList(); var entities = entitesObject.ToEntityList <TEntity>(); return(entities); }
public RpcContext(RpcConnection rpcConnection, string modelName) { _rpcConnection = rpcConnection; _rpcModel = new RpcModel(modelName, _rpcConnection); _records = new List <RpcRecord>(); RpcFilter = new RpcFilter(); _fieldNames = new List <string>(); }
public TEntity Get(int id) { var filter = new RpcFilter().Equal("id", id).ToArray(); var entity = connection.SearchAndRead(model, filter, propertiesName, limit: 1) .ToXmlRpcStructList() .ToEntityList <TEntity>() .FirstOrDefault(); return(entity); }
/// <summary> /// Total record count /// </summary> /// <returns></returns> public int Count() { if (!_rpcConnection.Login()) { _rpcConnection.Login(); } var filter = RpcFilter.ToArray(); return(_rpcModel.Count(filter)); }
public IEnumerable <RpcRecord> Execute(bool read = false, int offset = 0, int?limit = null) { if (!_rpcConnection.Login()) { _rpcConnection.Login(); } var fieldsResult = GetFields(); if (_fieldNames.Count == 0) { _fieldNames = fieldsResult.Select(f => f.FieldName).ToList(); } _rpcModel.AddFields(_fieldNames); return(_records = !read?_rpcModel.Search(RpcFilter.ToArray()) : _rpcModel.SearchAndRead(RpcFilter.ToArray(), fieldsResult, offset, limit)); }