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

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

            _service.Add(entity);
            _service.Complete();
        }
예제 #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));
        }