Exemple #1
0
 private bool CheckIfCollectionContainsValue(System.Collections.ICollection c)
 {
     NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = GetQuery().GetStorageEngine
                                                                 ();
     if (engine == null)
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.QueryEngineNotSet
                                                    );
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     // If the object to compared is native
     if (objectIsNative)
     {
         while (iterator.MoveNext())
         {
             aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
             if (aoi == null && criterionValue == null)
             {
                 return(true);
             }
             if (aoi != null && criterionValue == null)
             {
                 return(false);
             }
             if (criterionValue.Equals(aoi.GetObject()))
             {
                 return(true);
             }
         }
         return(false);
     }
     // Object is not native
     while (iterator.MoveNext())
     {
         aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
         if (aoi.IsNull() && criterionValue == null && oid == null)
         {
             return(true);
         }
         if (aoi != null & oid != null)
         {
             if (aoi.IsNonNativeObject())
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi1 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                   )aoi;
                 bool isEqual = nnoi1.GetOid() != null && oid != null && nnoi1.GetOid().Equals(oid
                                                                                               );
                 if (isEqual)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
        public override T Get(int index)
        {
            object o = base[index];

            NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                           )o;
            try
            {
                if (aoi.IsNull())
                {
                    return(default(T));
                }
                if (returnInstance)
                {
                    if (aoi.IsNative())
                    {
                        return((T)aoi.GetObject());
                    }
                    if (instanceBuilder == null)
                    {
                        // Lookup the instance builder
                        instanceBuilder = (NeoDatis.Odb.Core.Layers.Layer2.Instance.IInstanceBuilder)NeoDatis.Odb.Core.Lookup.LookupFactory
                                          .Get(sessionId).Get(NeoDatis.Odb.Impl.Core.Lookup.Lookups.InstanceBuilder);
                        if (instanceBuilder == null)
                        {
                            throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.LookupKeyNotFound
                                                                       .AddParameter(NeoDatis.Odb.Impl.Core.Lookup.Lookups.InstanceBuilder));
                        }
                    }
                    return((T)instanceBuilder.BuildOneInstance((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                )aoi));
                }
                // No need to return Instance return the layer 2 representation
                o = aoi;
                return((T)o);
            }
            catch (System.Exception e)
            {
                throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.ErrorWhileGettingObjectFromListAtIndex
                                                           .AddParameter(index), e);
            }
        }