/// <summary> /// 添加表连接关系 /// </summary> /// <param name="relationJoin">连接关系</param> /// <param name="thatTable">另一个表</param> /// <param name="thatAlia">另一个别名</param> /// <param name="relationField">主关联字段</param> /// <param name="thatRelationField">另一个关联字段</param> /// <param name="where">链接之前的筛选(以AND开头)</param> public void AddJoin(JoinEnum relationJoin, string thatTable, string thatAlia, string relationField, string thatRelationField, string where = "") { _joinList.Add(new JoinDictionary { RelationJoin = relationJoin, RelationField = relationField, ThatAlia = thatAlia, ThatRelationField = thatRelationField, ThatTable = thatTable, Where = where }); }
public static string ToExplain(this JoinEnum that) { switch (that) { case JoinEnum.FullJoin: return("FULL JOIN"); case JoinEnum.RightJoin: return("RIGHT JOIN"); case JoinEnum.LeftJoin: return("LEFT JOIN"); case JoinEnum.Join: return("JOIN"); } return(""); }
private void GenerateQueryWithJoinType(JoinEnum joinType, string joinString) { // Arrange var queryExpected = string.Join(" ", "SELECT", "`books`.`Id` `books_Id`, `books`.`Price` `books_Price`, `books`.`PublisherId` `books_PublisherId`, `books`.`Title` `books_Title`,", "`publishers`.`Id` `publishers_Id`, `publishers`.`Name` `publishers_Name`", "FROM `books`", joinString, "`publishers` ON `books`.`PublisherId` = `publishers`.`Id`"); var selectQueryBuilder = new SelectQueryBuilder() .WithJoin( joinType, GetTableNameWithQuotes <Book>(), GetTableNameWithQuotes <Publisher>(), (GetColumnNameWithQuotes <Book>(nameof(Book.PublisherId)), GetColumnNameWithQuotes <Publisher>(nameof(Publisher.Id)))); // Act var query = selectQueryBuilder.Build <Book>(); // Assert Assert.AreEqual(queryExpected, query); }
/// <summary> /// Initializes a new instance of the <see cref="GroupPrivacy" /> class. /// </summary> /// <param name="comment">Who can comment on the group. Option descriptions: * `all` - Anyone can comment on the group. * `members` - Only group members can comment on the group. (required).</param> /// <param name="invite">Who can invite new members to the group. Option descriptions: * `all` - Anyone can invite new members. * `members` - Only group members can invite new members. (required).</param> /// <param name="join">Who can join the group. Option descriptions: * `anybody` - Anyone can join the group. * `members` - Only people with a Vimeo account can join the group. (required).</param> /// <param name="videos">Who can add videos to the group. Option descriptions: * `all` - Anyone can add videos to the group. * `members` - Only group members can add videos to the group. (required).</param> /// <param name="view">Who can access the group. Option descriptions: * `anybody` - Anyone can access the group. * `members` - Only group members can access the group. (required).</param> public GroupPrivacy(CommentEnum comment = default(CommentEnum), InviteEnum invite = default(InviteEnum), JoinEnum join = default(JoinEnum), VideosEnum videos = default(VideosEnum), ViewEnum view = default(ViewEnum)) { this.Comment = comment; this.Invite = invite; this.Join = join; this.Videos = videos; this.View = view; }
internal void WithJoin( JoinEnum joinType, string leftTable, string rightTable, (string leftColumn, string rightColumn) columnConnection,
public DeleteQueryBuilder WithJoin(JoinEnum joinType, string leftTable, string rightTable, (string leftColumn, string rightColumn) columnConnection,
/// <summary> /// 初始化 /// </summary> /// <param name="join">连接符: (、)、and 、 or</param> /// <param name="value">值</param> public Expression(JoinEnum join) { Join = join; }