コード例 #1
0
 public virtual string GetDeleteRelationsSql(PropertyInfo manyToManyProp)
 {
     StringBuilder sb = new StringBuilder();
     ManyToManyAttribute manyToMany = manyToManyProp.GetManyToManyAttribute();
     sb.Append("delete from ");
     sb.Append(manyToMany.JoinTable);
     sb.Append(" where ");
     sb.Append(manyToMany.JoinColumn);
     sb.Append("=?");
     return sb.ToString();
 }
コード例 #2
0
 public virtual string GetAddRelationSql(PropertyInfo manyToManyProp)
 {
     StringBuilder sb = new StringBuilder();
     ManyToManyAttribute manyToMany = manyToManyProp.GetManyToManyAttribute();
     sb.Append("insert into ");
     sb.Append(manyToMany.JoinTable);
     sb.Append(" (");
     sb.Append(manyToMany.JoinColumn).Append(", ");
     sb.Append(manyToMany.InverseJoinColumn).Append(")");
     sb.Append(" values (?, ?)");
     return sb.ToString();
 }
コード例 #3
0
 public virtual string GetLoadManyToManyPropertySql(PropertyInfo prop, bool enableLazy, out Dictionary<string, string> resultMap)
 {
     ManyToManyAttribute manyToMany = prop.GetManyToManyAttribute();
     StringBuilder sb = new StringBuilder();
     sb.Append(prop.PropertyType.GetGenericArguments()[0].GetIdProperty().GetColumnAttribute().Name);
     sb.Append(" in (select ");
     sb.Append(manyToMany.InverseJoinColumn);
     sb.Append(" from ");
     sb.Append(manyToMany.JoinTable);
     sb.Append(" where ");
     sb.Append(manyToMany.JoinColumn);
     sb.Append("=?)");
     return GetSelectSql(prop.PropertyType.GetGenericArguments()[0], enableLazy, out resultMap, sb.ToString());
 }
コード例 #4
0
 private static bool NeedProxy(PropertyInfo prop, bool enableLazy, bool enforceLazy)
 {
     ColumnAttribute col = prop.GetColumnAttribute();
     if (col != null && col.LazyLoad && enableLazy)
     {
         return true;
     }
     ManyToOneAttribute manyToOne = prop.GetManyToOneAttribute();
     if (manyToOne != null && (manyToOne.LazyLoad && enableLazy || enforceLazy))
     {
         return true;
     }
     OneToManyAttribute oneToMany = prop.GetOneToManyAttribute();
     if (oneToMany != null && (oneToMany.LazyLoad && enableLazy || enforceLazy))
     {
         return true;
     }
     ManyToManyAttribute manyToMany = prop.GetManyToManyAttribute();
     if (manyToMany != null && (manyToMany.LazyLoad && enableLazy || enforceLazy))
     {
         return true;
     }
     return false;
 }