public override void StaticSqlStringCache(SqlModel model, Type type) { GsOperator gs = new GsOperator(typeof(SqlEntity <>), type); gs["SetPrimary"] = MebOperator.Setter(type, model.PrimaryKey); gs["Table"] = model.TableName; gs["Primary"] = model.PrimaryKey; CountTemplate count = new CountTemplate(); gs["SelectCount"] = count.SelectCount(model); gs["SelectCountWhere"] = count.SelectCountWhere(model); SelectTemplate select = new SelectTemplate(); gs["SelectAll"] = select.SelectAll(model); gs["SelectAllWhere"] = select.SelectAllWhere(model); gs["SelectAllByPrimary"] = select.SelectAllByPrimary(model); gs["SelectAllIn"] = select.SelectAllIn(model); UpdateTemplate update = new UpdateTemplate(); gs["UpdateAllWhere"] = update.UpdateWhere(model); gs["UpdateAllByPrimary"] = update.UpdateByPrimary(model); InsertTemplate insert = new InsertTemplate(); gs["InsertAll"] = insert.Insert(model); DeleteTemplate delete = new DeleteTemplate(); gs["DeleteWhere"] = delete.DeleteWhere(model); gs["DeleteByPrimary"] = delete.DeleteByPrimary(model); RepeateTemplate repeate = new RepeateTemplate(); var repeateModel = model.ModelWithAttr <NoRepeateAttribute>(); gs["RepeateCount"] = repeate.RepeateCount(repeateModel); gs["RepeateId"] = repeate.RepeateId(repeateModel); gs["RepeateEntities"] = repeate.RepeateEntities(repeateModel); }
/// <summary> /// 根据model信息生成 SELECT COUNT(*) FROM [TableName] WHERE [Member1]=@Member1 AND [Member2]=@Member2 .... /// </summary> /// <param name="model">载有生成信息的Model</param> /// <returns>查重字符串结果</returns> public static string RepeateCount(SqlModel model) { return(Repeate.RepeateCount(model)); }