Exemplo n.º 1
0
        protected IDeleteBuilder BuilderParse(ParamDelete param)
        {
            var data          = param.GetData();
            var from          = data.From.Length == 0 ? typeof(T).Name : data.From;
            var deleteBuilder = db.Delete(from);

            var where = GetSqlWhere(data.Where);
            if (data.Where.Exists(x => x.Symbol != "equal"))
            {
                foreach (var c in data.Where.Where(x => x.Symbol != "eqaul" && x.Parameters != null && x.Parameters.Count > 0))
                {
                    throw new Exception(string.Format("删除条件中的{0}未实现参数化!", c.Symbol));
                }

                deleteBuilder.Where(where);
            }
            else
            {
                foreach (var c in data.Where)
                {
                    deleteBuilder.Where(c.Column, c.Values[0]);
                }
            }

            return(deleteBuilder);
        }
Exemplo n.º 2
0
        public ParamDelete ToParamDelete()
        {
            var pDelete = ParamDelete.Instance();

            pDelete.From(GetTableName());
            EachWhere(c => pDelete.Where(builder => BuildCondition(builder, c)));
            return(pDelete);
        }
Exemplo n.º 3
0
        protected IDeleteBuilder BuilderParse(ParamDelete param)
        {
            var data          = param.GetData();
            var deleteBuilder = db.Delete(data.From.Length == 0 ? typeof(T).Name : data.From);

            deleteBuilder.Where(data.WhereSql);

            return(deleteBuilder);
        }
Exemplo n.º 4
0
        public ParamDelete ToParamDelete()
        {
            var settings = XElement.Parse(settingXml);
            var pDelete  = ParamDelete.Instance().From(getXmlElementValue(settings, "table"));

            parseWhere(settings, (name, value, compare, variable, extend) => pDelete.AndWhere(name, value, compare, extend));

            return(pDelete);
        }