Beispiel #1
0
        public void Add(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return;
            }

            TEntity entity = JsonConvert.DeserializeObject <TEntity>(data);

            _service.Add(entity);
            _service.Complete();
        }
Beispiel #2
0
        public long Add(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return(0);
            }

            TEntity entity = JsonConvert.DeserializeObject <TEntity>(data);

            _service.Add(entity);
            _service.Complete();

            var idProp = entity.GetType().GetProperty("ID");

            return(idProp == null ? 0 : (long)idProp.GetValue(entity, null));
        }