コード例 #1
0
 public override System.Collections.Generic.IList <T> GetValueList <T>(int index) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (!context.GetPersistenceUnit().GetPersistenceGroup().CurrentSessionExists())
     {
         if (sessionAwareInstance == null)
         {
             sessionAwareInstance = context.GetPersistenceUnit().GetPersistenceGroup().GetContext().MakeSessionAware <Net.Vpc.Upa.Impl.Persistence.DefaultQuery>(this);
         }
         return(sessionAwareInstance.GetValueList <T>(index));
     }
     try {
         Net.Vpc.Upa.Impl.Persistence.QueryExecutor queryExecutor = ExecuteQuery(Net.Vpc.Upa.Impl.Util.Filters.Fields2.READ);
         if (index < 0 || index > (queryExecutor.GetMetaData().GetFields()).Count)
         {
             throw new System.IndexOutOfRangeException("Invalid index " + index);
         }
         Net.Vpc.Upa.Impl.Persistence.ValueList <T> r = new Net.Vpc.Upa.Impl.Persistence.ValueList <T>(queryExecutor, index);
         allResults.Add(r);
         if (!IsLazyListLoadingEnabled())
         {
             //force loading
             r.LoadAll();
         }
         return(r);
     } catch (System.Exception e) {
         throw new Net.Vpc.Upa.Exceptions.FindException(e, new Net.Vpc.Upa.Types.I18NString("FindFailed"));
     }
 }
コード例 #2
0
 public override System.Collections.Generic.IList <T> GetValueList <T>(string name) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (!context.GetPersistenceUnit().GetPersistenceGroup().CurrentSessionExists())
     {
         if (sessionAwareInstance == null)
         {
             sessionAwareInstance = context.GetPersistenceUnit().GetPersistenceGroup().GetContext().MakeSessionAware <Net.Vpc.Upa.Impl.Persistence.DefaultQuery>(this);
         }
         return(sessionAwareInstance.GetValueList <T>(name));
     }
     try {
         Net.Vpc.Upa.Impl.Persistence.QueryExecutor queryExecutor = ExecuteQuery(Net.Vpc.Upa.Impl.Util.Filters.Fields2.READ);
         System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> ne = queryExecutor.GetMetaData().GetFields();
         int index = -1;
         for (int i = 0; i < (ne).Count; i++)
         {
             if (name.Equals(ne[i].GetAlias()))
             {
                 index = i;
                 break;
             }
         }
         if (index < 0)
         {
             throw new System.Exception("Field " + name + " not found");
         }
         Net.Vpc.Upa.Impl.Persistence.ValueList <T> r = new Net.Vpc.Upa.Impl.Persistence.ValueList <T>(queryExecutor, index);
         if (!IsLazyListLoadingEnabled())
         {
             //force loading
             r.LoadAll();
         }
         allResults.Add(r);
         return(r);
     } catch (System.Exception e) {
         throw new Net.Vpc.Upa.Exceptions.FindException(e, new Net.Vpc.Upa.Types.I18NString("FindFailed"));
     }
 }