public ParamUpdate ToParamUpdate() { var settings = XElement.Parse(settingXml); var pUpdate = ParamUpdate.Instance().Update(getXmlElementValue(settings, "table")); var list = new List <string>(); parseWhere(settings, (name, value, compare, variable, extend) => { pUpdate.AndWhere(name, value, compare, extend); list.Add(variable); }); parseColumns(settings, (name, value) => { if (list.IndexOf(name) < 0) { pUpdate.Column(name, value); } }); return(pUpdate); }
protected IUpdateBuilder BuilderParse(ParamUpdate param) { var data = param.GetData(); var updateBuilder = db.Update(data.Update.Length == 0 ? typeof(T).Name : data.Update); var dict = GetPersonDateForUpdate(); foreach (var column in data.Columns.Where(column => !dict.ContainsKey(column.Key))) { updateBuilder.Column(column.Key, column.Value); } var properties = Chama.Utils.ZReflection.GetProperties(typeof(T)); foreach (var item in dict.Where(item => properties.ContainsKey(item.Key.ToLower()))) { updateBuilder.Column(item.Key, item.Value); } updateBuilder.Where(data.WhereSql); return(updateBuilder); }