Beispiel #1
0
 /// <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
     });
 }
Beispiel #2
0
        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);
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupPrivacy" /> class.
 /// </summary>
 /// <param name="comment">Who can comment on the group.  Option descriptions:  * &#x60;all&#x60; - Anyone can comment on the group.  * &#x60;members&#x60; - Only group members can comment on the group.  (required).</param>
 /// <param name="invite">Who can invite new members to the group.  Option descriptions:  * &#x60;all&#x60; - Anyone can invite new members.  * &#x60;members&#x60; - Only group members can invite new members.  (required).</param>
 /// <param name="join">Who can join the group.  Option descriptions:  * &#x60;anybody&#x60; - Anyone can join the group.  * &#x60;members&#x60; - Only people with a Vimeo account can join the group.  (required).</param>
 /// <param name="videos">Who can add videos to the group.  Option descriptions:  * &#x60;all&#x60; - Anyone can add videos to the group.  * &#x60;members&#x60; - Only group members can add videos to the group.  (required).</param>
 /// <param name="view">Who can access the group.  Option descriptions:  * &#x60;anybody&#x60; - Anyone can access the group.  * &#x60;members&#x60; - 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,
Beispiel #7
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="join">连接符: (、)、and 、 or</param>
 /// <param name="value">值</param>
 public Expression(JoinEnum join)
 {
     Join = join;
 }