public void Add(string data) { if (string.IsNullOrEmpty(data)) { return; } TEntity entity = JsonConvert.DeserializeObject <TEntity>(data); _service.Add(entity); _service.Complete(); }
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)); }