Пример #1
0
        public override void SetMetaModel(NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel
                                          metaModel2)
        {
            NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci        = null;
            NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = new NeoDatis.Odb.Core.Layers.Layer2.Meta.SessionMetaModel
                                                                           ();
            GetSession(true).SetMetaModel(metaModel);
            // Just add the classes
            System.Collections.IEnumerator iterator = metaModel2.GetAllClasses().GetEnumerator
                                                          ();
            while (iterator.MoveNext())
            {
                this.GetMetaModel().AddClass((NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator
                                             .Current);
            }
            // Now persists classes
            iterator = metaModel.GetAllClasses().GetEnumerator();
            int i = 0;

            while (iterator.MoveNext())
            {
                ci = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator.Current;
                if (ci.GetPosition() == -1)
                {
                    objectWriter.PersistClass(ci, (i == 0 ? -2 : i - 1), false, false);
                }
                i++;
            }
        }
Пример #2
0
 public override void AddSession(ISession session, bool
                                 readMetamodel)
 {
     // Associate current session to the fsi -> all transaction writes
     // will be applied to this FileSystemInterface
     session.SetFileSystemInterfaceToApplyTransaction(objectWriter.GetFsi());
     if (readMetamodel)
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = null;
         try
         {
             objectReader.ReadDatabaseHeader(baseIdentification.GetUserName(), baseIdentification
                                             .GetPassword());
         }
         catch (NeoDatis.Odb.ODBAuthenticationRuntimeException e)
         {
             Close();
             throw;
         }
         metaModel = new NeoDatis.Odb.Core.Layers.Layer2.Meta.SessionMetaModel();
         session.SetMetaModel(metaModel);
         metaModel = objectReader.ReadMetaModel(metaModel, true);
         // Updates the Transaction Id in the file
         objectWriter.WriteLastTransactionId(GetCurrentTransactionId());
     }
 }
		public override void SetMetaModel(NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel 
			metaModel2)
		{
			NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = null;
			NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = new NeoDatis.Odb.Core.Layers.Layer2.Meta.SessionMetaModel
				();
			GetSession(true).SetMetaModel(metaModel);
			// Just add the classes
			System.Collections.IEnumerator iterator = metaModel2.GetAllClasses().GetEnumerator
				();
			while (iterator.MoveNext())
			{
				this.GetMetaModel().AddClass((NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator
					.Current);
			}
			// Now persists classes
			iterator = metaModel.GetAllClasses().GetEnumerator();
			int i = 0;
			while (iterator.MoveNext())
			{
				ci = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo)iterator.Current;
				if (ci.GetPosition() == -1)
				{
					objectWriter.PersistClass(ci, (i == 0 ? -2 : i - 1), false, false);
				}
				i++;
			}
		}
		public override void AddSession(ISession session, bool
			 readMetamodel)
		{
			// Associate current session to the fsi -> all transaction writes
			// will be applied to this FileSystemInterface
			session.SetFileSystemInterfaceToApplyTransaction(objectWriter.GetFsi());
			if (readMetamodel)
			{
				NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = null;
				try
				{
					objectReader.ReadDatabaseHeader(baseIdentification.GetUserName(), baseIdentification
						.GetPassword());
				}
				catch (NeoDatis.Odb.ODBAuthenticationRuntimeException e)
				{
					Close();
					throw;
				}
				metaModel = new NeoDatis.Odb.Core.Layers.Layer2.Meta.SessionMetaModel();
				session.SetMetaModel(metaModel);
				metaModel = objectReader.ReadMetaModel(metaModel, true);
				// Updates the Transaction Id in the file
				objectWriter.WriteLastTransactionId(GetCurrentTransactionId());
			}
		}