/// <exception cref="System.Exception"></exception>
		public virtual object FromString(string data)
		{
			string[] tokens = NeoDatis.Tool.Wrappers.OdbString.Split(data, NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer
				.FieldSeparator);
			if (!tokens[0].Equals(classId))
			{
				throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.SerializationFromString
					.AddParameter(classId).AddParameter(tokens[0]));
			}
			string realCollectionName = tokens[1];
			int collectionSize = int.Parse(tokens[2]);
			string collectionData = tokens[3];
			string[] objects = NeoDatis.Tool.Wrappers.OdbString.Split(collectionData, NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer
				.CollectionElementSeparator);
			if (objects.Length != collectionSize)
			{
				throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.SerializationCollection
					.AddParameter(collectionSize).AddParameter(objects.Length));
			}
			System.Collections.Generic.ICollection<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				> l = new System.Collections.Generic.List<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				>(collectionSize);
			for (int i = 0; i < collectionSize; i++)
			{
				l.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer
					.GetInstance().FromOneString(objects[i]));
			}
			NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
				(l);
			coi.SetRealCollectionClassName(realCollectionName);
			return coi;
		}
 public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
     (System.Collections.Generic.IDictionary <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                              > cache, bool onlyData)
 {
     System.Collections.ICollection c = (System.Collections.ICollection)theObject;
     System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                             > newCollection = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                                                             >();
     // To keep track of non native objects
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                           > nonNatives = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                                        >();
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     while (iterator.MoveNext())
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                        )iterator.Current;
         // create copy
         aoi = aoi.CreateCopy(cache, onlyData);
         newCollection.Add(aoi);
         if (aoi.IsNonNativeObject())
         {
             nonNatives.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi);
         }
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
                                                                         (newCollection, odbType, nonNatives);
     coi.SetRealCollectionClassName(realCollectionClassName);
     return(coi);
 }
Exemplo n.º 3
0
        /// <exception cref="System.Exception"></exception>
        public virtual object FromString(string data)
        {
            string[] tokens = NeoDatis.Tool.Wrappers.OdbString.Split(data, NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer
                                                                     .FieldSeparator);
            if (!tokens[0].Equals(classId))
            {
                throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.SerializationFromString
                                                           .AddParameter(classId).AddParameter(tokens[0]));
            }
            string realCollectionName = tokens[1];
            int    collectionSize     = int.Parse(tokens[2]);
            string collectionData     = tokens[3];

            string[] objects = NeoDatis.Tool.Wrappers.OdbString.Split(collectionData, NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer
                                                                      .CollectionElementSeparator);
            if (objects.Length != collectionSize)
            {
                throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.SerializationCollection
                                                           .AddParameter(collectionSize).AddParameter(objects.Length));
            }
            System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                    > l = new System.Collections.Generic.List <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                                               >(collectionSize);
            for (int i = 0; i < collectionSize; i++)
            {
                l.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.Serializer
                      .GetInstance().FromOneString(objects[i]));
            }
            NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
                                                                                (l);
            coi.SetRealCollectionClassName(realCollectionName);
            return(coi);
        }
		public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
			(System.Collections.Generic.IDictionary<NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
			> cache, bool onlyData)
		{
			System.Collections.ICollection c = (System.Collections.ICollection)theObject;
			System.Collections.Generic.ICollection<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				> newCollection = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				>();
			// To keep track of non native objects
			NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				> nonNatives = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				>();
			System.Collections.IEnumerator iterator = c.GetEnumerator();
			while (iterator.MoveNext())
			{
				NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
					)iterator.Current;
				// create copy
				aoi = aoi.CreateCopy(cache, onlyData);
				newCollection.Add(aoi);
				if (aoi.IsNonNativeObject())
				{
					nonNatives.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi);
				}
			}
			NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
				(newCollection, odbType, nonNatives);
			coi.SetRealCollectionClassName(realCollectionClassName);
			return coi;
		}