Example #1
0
        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);
        }
Example #2
0
        public List <RpcRecord> SearchAndRead(object[] filter, List <RpcField> fieldsResult, int offset = 0, int?limit = null)
        {
            var records = new List <RpcRecord>();

            object[] result = _rpcConnection.SearchAndRead(_modelName, filter, _fields.ToArray(), offset, limit);

            foreach (object entry in result)
            {
                var vals   = (XmlRpcStruct)entry;
                var id     = (int)vals["id"];
                var record = new RpcRecord(_rpcConnection, _modelName, id, fieldsResult, vals);
                records.Add(record);
            }
            return(records);
        }