Esempio n. 1
0
 public virtual string GetLoadManyToOnePropertySql(PropertyInfo prop, bool enableLazy, out Dictionary<string, string> resultMap)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append(prop.PropertyType.GetIdProperty().GetColumnAttribute().Name);
     sb.Append("=(select ");
     sb.Append(prop.GetManyToOneAttribute().ForeignKey);
     sb.Append(" from ");
     sb.Append(prop.DeclaringType.GetTableAttribute().Name);
     sb.Append(" where ");
     sb.Append(prop.DeclaringType.GetIdProperty().GetColumnAttribute().Name);
     sb.Append("=?)");
     return GetSelectSql(prop.PropertyType, enableLazy, out resultMap, sb.ToString());
 }
Esempio n. 2
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;
 }