Exemplo n.º 1
0
        public virtual void TestArray3()
        {
            NeoDatis.Odb.ODB odb = null;
            int size             = 50;

            try
            {
                DeleteBase("array1.neodatis");
                odb = Open("array1.neodatis");
                short[] array = new short[size];
                for (int i = 0; i < size; i++)
                {
                    array[i] = (short)i;
                }
                ObjectWithNativeArrayOfShort owna = new ObjectWithNativeArrayOfShort
                                                        ("t1", array);
                odb.Store(owna);
                odb.Close();
                odb = Open("array1.neodatis");
                NeoDatis.Odb.Objects <ObjectWithNativeArrayOfShort> l = odb.GetObjects <ObjectWithNativeArrayOfShort>();
                ObjectWithNativeArrayOfShort owna2 = l.GetFirst();
                AssertEquals(owna.GetName(), owna2.GetName());
                for (int i = 0; i < size; i++)
                {
                    AssertEquals(owna.GetNumbers()[i], owna2.GetNumbers()[i]);
                }
                odb.Close();
                odb = null;
            }
            catch (System.Exception e)
            {
                if (odb != null)
                {
                    odb.Rollback();
                    odb = null;
                }
                throw;
            }
            finally
            {
                if (odb != null)
                {
                    odb.Close();
                }
                DeleteBase("array1.neodatis");
            }
        }
Exemplo n.º 2
0
		/// <exception cref="System.Exception"></exception>
		public virtual void TestArray3()
		{
			NeoDatis.Odb.ODB odb = null;
			int size = 50;
			try
			{
				DeleteBase("array1.neodatis");
				odb = Open("array1.neodatis");
				short[] array = new short[size];
				for (int i = 0; i < size; i++)
				{
					array[i] = (short)i;
				}
				ObjectWithNativeArrayOfShort owna = new ObjectWithNativeArrayOfShort
					("t1", array);
				odb.Store(owna);
				odb.Close();
				odb = Open("array1.neodatis");
				NeoDatis.Odb.Objects<ObjectWithNativeArrayOfShort> l = odb.GetObjects<ObjectWithNativeArrayOfShort>();
				ObjectWithNativeArrayOfShort owna2 = l.GetFirst();
				AssertEquals(owna.GetName(), owna2.GetName());
				for (int i = 0; i < size; i++)
				{
					AssertEquals(owna.GetNumbers()[i], owna2.GetNumbers()[i]);
				}
				odb.Close();
				odb = null;
			}
			catch (System.Exception e)
			{
				if (odb != null)
				{
					odb.Rollback();
					odb = null;
				}
				throw;
			}
			finally
			{
				if (odb != null)
				{
					odb.Close();
				}
				DeleteBase("array1.neodatis");
			}
		}