Exemplo n.º 1
0
        private void InitDatabase()
        {
#if DB4O_8_0
            DatabaseConfiguration = Db4oEmbedded.NewConfiguration();
            DatabaseConfiguration.Common.AllowVersionUpdates = true;
            DatabaseConfiguration.Common.ActivationDepth     = 0;
            //DatabaseConfiguration.Common.Queries.EvaluationMode(QueryEvaluationMode.Lazy);
            DatabaseConfiguration.Common.WeakReferenceCollectionInterval = 60 * 1000;
            //DatabaseConfiguration.Common.Diagnostic.AddListener(new DiagnosticToConsole());
            var msgConf = DatabaseConfiguration.Common.ObjectClass(typeof(MessageModel));
            msgConf.CascadeOnActivate(true);
            msgConf.CascadeOnDelete(true);
            msgConf.Indexed(true);
            msgConf.ObjectField("f_TimeStamp").Indexed(true);
#else
            DatabaseConfiguration = Db4oFactory.Configure();
            DatabaseConfiguration.AllowVersionUpdates(true);
            DatabaseConfiguration.ObjectClass(typeof(MessageModel)).
            ObjectField("f_TimeStamp").Indexed(true);
#endif
            try {
                OpenDatabase();
            } catch (Exception ex) {
#if LOG4NET
                Logger.Error("InitDatabase(): failed to open message " +
                             "database: " + DatabaseFile, ex);
#endif
                throw;
            }
        }
Exemplo n.º 2
0
        void ConfigureDatabase()
        {
#if DB4O_8_0
            DatabaseConfiguration = Db4oEmbedded.NewConfiguration();
            DatabaseConfiguration.Common.AllowVersionUpdates = true;
            DatabaseConfiguration.Common.ActivationDepth     = 0;
            //DatabaseConfiguration.Common.Queries.EvaluationMode(QueryEvaluationMode.Lazy);
            DatabaseConfiguration.Common.WeakReferenceCollectionInterval = 60 * 1000;
            //DatabaseConfiguration.Common.Diagnostic.AddListener(new DiagnosticToConsole());
            var msgConf = DatabaseConfiguration.Common.ObjectClass(typeof(MessageModel));
            msgConf.CascadeOnActivate(true);
            msgConf.CascadeOnDelete(true);
            msgConf.Indexed(true);
            msgConf.ObjectField("f_TimeStamp").Indexed(true);
#else
            DatabaseConfiguration = Db4oFactory.Configure();
            DatabaseConfiguration.AllowVersionUpdates(true);
            DatabaseConfiguration.ObjectClass(typeof(MessageModel)).
            ObjectField("f_TimeStamp").Indexed(true);
#endif
        }