protected string GetSplitter(SimpleJoinAttribute joinAttribute) { return(joinAttribute.NoSplit ? string.Empty : string.Format("SplitOn{0}{1}", joinAttribute.JoinedTable, joinAttribute.JoinedTableField)); }
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); }
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); }
protected string GetSplitter(SimpleJoinAttribute joinAttribute) { return(joinAttribute.NoSplit ? string.Empty : $"SplitOn{joinAttribute.JoinedTable.Replace("[", "").Replace("]", "")}{joinAttribute.JoinedTableField}"); }