Ejemplo n.º 1
0
 public JoinOnAttribute(int index, string table1, string key1, string table2, string key2, CompareOpration comp, JoinMode mode)
 {
     this.Index = index;
     Joinner = new JoinClause(table1, key1, table2, key2, comp, mode);
 }
Ejemplo n.º 2
0
 private static FromClause GetJoinedFrom(Type modelType, JoinOnAttribute[] joins)
 {
     if (joins.Length == 0)
     {
         string definedName = NameMapper.Instance.MapName(modelType.Name);
         return new FromClause(modelType.Name, GetTableNameFromConfig(definedName));
     }
     var joinClauseList = new JoinClause[joins.Length];
     for (int i = 0; i < joins.Length; i++)
     {
         int index = joins[i].Index;
         if (index < 0)
         {
             index = i;
         }
         joinClauseList[index] = joins[i].Joinner;
     }
     foreach (var t in joinClauseList)
     {
         if (t == null)
         {
             throw new ArgumentException(string.Format("class [{0}] JoinOnAttribute defined error.", modelType.Name));
         }
     }
     return new FromClause(joinClauseList);
 }