コード例 #1
0
 protected string GetSplitter(SimpleJoinAttribute joinAttribute)
 {
     return(joinAttribute.NoSplit
                ? string.Empty
                : string.Format("SplitOn{0}{1}", joinAttribute.JoinedTable,
                                joinAttribute.JoinedTableField));
 }
コード例 #2
0
        public void CreateNotJoinTest()
        {
            var creator = new SimpleJoinClauseCreator();
            var attr    = new SimpleJoinAttribute("CurrentTableField", JoinType.Left, "JoinedTable")
            {
                CurrentTable     = "CurrentTable",
                JoinedTableField = "JoinedField"
            };
            var res = creator.CreateNotJoin(attr);

            Assert.AreEqual(JoinType.Left, res.JoinType);
            Assert.IsTrue(res.JoinSqls == null || !res.JoinSqls.Any());
            Assert.AreEqual("SplitOnJoinedTableJoinedField", res.Splitter);
            Assert.IsFalse(res.HasJoin);
        }
コード例 #3
0
        public void CreateTest()
        {
            var creator = new SimpleJoinClauseCreator();
            var attr    = new SimpleJoinAttribute("CurrentTableField", JoinType.Left, "JoinedTable")
            {
                CurrentTable     = "CurrentTable",
                JoinedTableField = "JoinedField"
            };
            var res = creator.Create(attr);

            Assert.AreEqual(JoinType.Left, res.JoinType);
            Assert.AreEqual(1, res.JoinSqls.Count());
            Assert.AreEqual(1, res.SelectsSql.Count());
            Assert.AreEqual("JoinedTable.*", res.SelectsSql.First());
            Assert.AreEqual("SplitOnJoinedTableJoinedField", res.Splitter);
            Assert.AreEqual("JoinedTable on JoinedTable.JoinedField = CurrentTable.CurrentTableField",
                            res.JoinSqls.First());
            Assert.IsTrue(res.HasJoin);
        }
コード例 #4
0
 protected string GetSplitter(SimpleJoinAttribute joinAttribute)
 {
     return(joinAttribute.NoSplit
                ? string.Empty
                : $"SplitOn{joinAttribute.JoinedTable.Replace("[", "").Replace("]", "")}{joinAttribute.JoinedTableField}");
 }