Exemple #1
0
        public void PersistExcuteItem(SaveInfo item)
        {
            var cmd = Connection.CreateCommand();

            cmd.Transaction = Transaction;
            cmd.CommandText = item.CommandText;
            cmd.CommandType = item.CommandType;
            cmd             = IoC.Resolve <IMapper>().CreateCommandParams(cmd, item.ParamsInfo);
            cmd.ExecuteNonQuery();
        }
Exemple #2
0
 public void PersistExcuteItemT(SaveInfo item)
 {
     if (item.CallBack == null)
     {
         Connection.Execute(item.CommandText, item.ParamEntityInfo, Transaction);
     }
     else
     {
         var res = Connection.Query(item.CommandText, item.ParamEntityInfo, Transaction).ToList();
         item.CallBack(res);
     }
 }
Exemple #3
0
        public void PersistNewItem(SaveInfo item)
        {
            int newId = 0;

            var objnewId = Connection.Query <object>(IoC.Resolve <IMapper>().GetNewCommand(item.Info.GetType()), item.Info, Transaction).FirstOrDefault();

            if (objnewId is IDictionary <string, object> dicts)
            {
                var id = dicts.Values.FirstOrDefault();
                if (id != null)
                {
                    int.TryParse(id.ToString(), out newId);
                }
            }

            item.Info.AutoIncrementId = newId;
        }
Exemple #4
0
 public void PersistDeletedItem(SaveInfo item)
 {
     Connection.Execute(IoC.Resolve <IMapper>().GetRemoveCommand(item.Info.GetType()), item.Info, Transaction);
 }