コード例 #1
0
        private IEmbeddedConfiguration Config()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.File.Storage = new MemoryStorage();
            return(config);
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

            configuration.Common.ObjectClass(typeof(IndexedClass)).ObjectField("id").Indexed(true);
            using (IObjectContainer container = Db4oEmbedded.OpenFile(configuration, "database.db4o"))
            {
                container.Store(new IndexedClass(1));
                // #example: Check for a index
                IStoredClass metaInfo = container.Ext().StoredClass(typeof(IndexedClass));
                // list a fields and check if they have a index
                foreach (IStoredField field in metaInfo.GetStoredFields())
                {
                    if (field.HasIndex())
                    {
                        Console.WriteLine("The field '" + field.GetName() + "' is indexed");
                    }
                    else
                    {
                        Console.WriteLine("The field '" + field.GetName() + "' isn't indexed");
                    }
                }
                // #end example
            }
        }
コード例 #3
0
        private IObjectContainer OpenObjectContainer(bool lockDatabaseFile)
        {
            var config = Db4oEmbedded.NewConfiguration();

            config.File.LockDatabaseFile = lockDatabaseFile;
            return(Db4oEmbedded.OpenFile(config, TempFile()));
        }
コード例 #4
0
        protected virtual IEmbeddedConfiguration NewConfiguration()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.AddConfigurationItem(new SilverlightSupport());
            return(config);
        }
コード例 #5
0
        private IObjectContainer NewInstance()
        {
            var configuration = Db4oEmbedded.NewConfiguration();

            configuration.File.Storage = fileSystem;
            return(Db4oEmbedded.OpenFile(configuration, "!In:Memory"));
        }
コード例 #6
0
        private IEmbeddedConfiguration ConfigWith(IReflector reflector)
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.ReflectWith(reflector);
            return(config);
        }
コード例 #7
0
        private IEmbeddedConfiguration ReadOnlyConfiguration()
        {
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

            configuration.File.ReadOnly = true;
            return(configuration);
        }
コード例 #8
0
ファイル: App.xaml.cs プロジェクト: yuuhhe/db4o
        private static IEmbeddedConfiguration Config()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.File.Storage = new IsolatedStorageStorage();
            return(config);
        }
コード例 #9
0
            public virtual void Open()
            {
                var config = Db4oEmbedded.NewConfiguration();

                config.File.Storage = new MemoryStorage();
                _server             = Db4oEmbedded.OpenFile(config, string.Empty);
            }
コード例 #10
0
        private IEmbeddedObjectContainer OpenDatabase()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.File.Storage = _storage;
            return(Db4oEmbedded.OpenFile(config, DatabaseFileName));
        }
コード例 #11
0
        private static IEmbeddedConfiguration NewEmbeddedConfiguration(IConfigurationItem support)
        {
            var config = Db4oEmbedded.NewConfiguration();

            config.Common.Add(support);
            return(config);
        }
コード例 #12
0
ファイル: Core.cs プロジェクト: p8Orion/mineria90529
        public Core()
        {
            // Base de datos
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.UpdateDepth = 3;  // Para almancenar objetos anidados (listas, etc.) en DB.
            //config.Common.StringEncoding = StringEncodings.Utf8();   // Esto ahorra mucho espacio pero genera dificultades
            db = Db4oEmbedded.OpenFile(config, dbName);

            words = new Dictionary <string, int>();
            InitWords();

            TA = new TweetAnalyzer(db, this);

            mediumBlockTimer          = new System.Timers.Timer();
            mediumBlockTimer.Interval = TS_medium.TotalMilliseconds;
            mediumBlockTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnMediumBlockTimer);

            longBlockTimer          = new System.Timers.Timer();
            longBlockTimer.Interval = TS_long.TotalMilliseconds;
            longBlockTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnLongBlockTimer);

            shortBlockTimer          = new System.Timers.Timer();
            shortBlockTimer.Interval = TS_short.TotalMilliseconds;
            shortBlockTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnShortBlockTimer);

            quickBlockTimer          = new System.Timers.Timer();
            quickBlockTimer.Interval = TS_quick.TotalMilliseconds;
            quickBlockTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnQuickBlockTimer);
        }
コード例 #13
0
        public virtual void Test()
        {
            IEmbeddedConfiguration embeddedConfiguration = Db4oEmbedded.NewConfiguration();

            Assert.Expect(typeof(ArgumentException), new _ICodeBlock_14(embeddedConfiguration
                                                                        ));
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: dan-laskowski/OBD_Projekt
        static void Main(string[] args)
        {
            // UTWORZENIE OBIEKTU BAZY DANYCH
            IObjectContainer db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), "PojazdyDB");

            try
            {
                // UTWORZENIE OBIEKTÓW KLAS
                /// UPRAWNIENIA ///
                Uprawnienia uprawnieniaWysokie = new Uprawnienia(true, true);
                Uprawnienia uprawnieniaNiskie  = new Uprawnienia(false, true);
                /// STANOWISKO ///
                Stanowisko kierowca1 = new Stanowisko("Doœwiadczony kierowca", 5000, uprawnieniaWysokie);
                Stanowisko kierowca2 = new Stanowisko("Niedoœwiadczony kierowca", 3000, uprawnieniaNiskie);
                /// PRACOWNIK ///
                Pracownik andrzejKowalski = new Pracownik("Andrzej", "Kowalski", "12 kwietnia 1975", kierowca2);

                Pracownik zygmuntZachorski = new Pracownik("Zygmunt", "Zachorski", "30 czerwca 1963", kierowca1);
                /// AUTOBUS ///
                Autobus solaris1 = new Autobus("Solaris Urbino 18", "WX 36543", 3, 2014, 130000, 120, andrzejKowalski);
                /// CIEZAROWKA ///
                Ciezarowka iveco1 = new Ciezarowka("Iveco Eurocargo", "WX 859JF", 2, 2010, 170000, 3500, zygmuntZachorski);

                // UMIESZCZENIE OBIEKTÓW DO BAZY DANYCH
                db.Store(uprawnieniaWysokie);
                db.Store(uprawnieniaNiskie);
                db.Store(kierowca1);
                db.Store(kierowca2);
                db.Store(andrzejKowalski);
                db.Store(zygmuntZachorski);
                db.Store(solaris1);
                db.Store(iveco1);
                Console.WriteLine("Operation completed: objects stored!");
                Console.WriteLine("\nQueries: ");

                // WYSZUKAJ I WYŒWIETL OBIEKTY KLASY PRACOWNIK #QueryByExample
                IObjectSet result = db.QueryByExample(typeof(Pojazd));
                ListResult(result);
                // DLA KA¯DEGO WYSZUKANEGO POJAZDU WYŒWIETL METODÊ PrzedstawSiê() oraz Jedz()
                foreach (Pojazd item in result)
                {
                    item.OpiszSie();
                    item.Jedz(100);
                }
                // DLA KA¯DEGO WYSZUKANEGO PRACOWNIKA WYŒWIETL METODÊ PrzedstawSiê() oraz Jedz()
                IObjectSet result2 = db.QueryByExample(typeof(Pracownik));
                foreach (Pracownik item in result2)
                {
                    item.PrzedstawSie();
                }


                Console.ReadKey();
            }
            finally
            {
                db.Close();
            }
        }
コード例 #15
0
        protected void Application_Start(object sender, EventArgs e)
        {
            ///*Load dll dynamicly in order to  allow publish only specific dlls.*/
            string path = Server.MapPath("~/test.db4o");


            IEmbeddedConfiguration serverConfig = Db4oEmbedded.NewConfiguration();

            serverConfig.Common.ObjectClass(typeof(module)).ObjectField("RoutePrefix").Indexed(true);
            serverConfig.Common.Add(new UniqueFieldValueConstraint(typeof(module), "RoutePrefix"));

            IObjectSet result;

            using (IObjectContainer db = Db4oEmbedded.OpenFile(serverConfig, path))
            {
                module m = new module()
                {
                    AssemblyQualifiedName = "EdgeBI.API.Web.EdgeApiTools,EdgeBI.API.Web.EdgeApiTools", RoutePrefix = "Tools"
                };
                db.Store(m);
                try
                {
                    db.Commit();
                }
                catch (Exception)
                {
                    db.Rollback();
                }

                module m2 = new module()
                {
                    AssemblyQualifiedName = "EdgeBI.API.Web.Facebook,EdgeBI.API.Web.EXT", RoutePrefix = "ext"
                };
                db.Store(m2);
                try
                {
                    db.Commit();
                }
                catch (Exception)
                {
                    db.Rollback();
                }
                result = db.QueryByExample(typeof(module));
                db.Ext().Refresh(result, 0);
                foreach (module mm in result)
                {
                    Type t = Type.GetType(mm.AssemblyQualifiedName, false);
                    if (t != null)
                    {
                        var route1 = new ServiceRoute(mm.RoutePrefix, new EdgeApiServiceHostFactory(new EdgeApiServiceConfiguration()), t);
                        RouteTable.Routes.Add(route1);
                    }
                }
            }

            var route2 = new ServiceRoute("", new EdgeApiServiceHostFactory(new EdgeApiServiceConfiguration()), typeof(EdgeApiCore));

            RouteTable.Routes.Add(route2);
        }
コード例 #16
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();

            var pathToDbFile = ConfigurationManager.AppSettings["PathToDBFile"];
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

            // TODO: remove if FillDatabase. Also remember to delete file.
            configuration.File.ReadOnly = true;

            // TODO: AddListener if diagnostic info is needed.
            //configuration.Common.Diagnostic.AddListener(new DiagnosticToConsole());

            configuration.Common.OptimizeNativeQueries = false;

            // Turn on transparent activation.
            configuration.Common.Add(new TransparentActivationSupport());

            // Creating indexes.
            configuration.Common.ObjectClass(typeof(Artist)).ObjectField("name").Indexed(true);
            configuration.Common.ObjectClass(typeof(Gallery)).ObjectField("name").Indexed(true);
            configuration.Common.ObjectClass(typeof(Painting)).ObjectField("title").Indexed(true);
            configuration.Common.ObjectClass(typeof(Painting)).ObjectField("artist").Indexed(true);
            configuration.Common.ObjectClass(typeof(Exposition)).ObjectField("gallery").Indexed(true);
            configuration.Common.ObjectClass(typeof(Exposition)).ObjectField("painting").Indexed(true);
            configuration.Common.ObjectClass(typeof(Exposition)).ObjectField("timeFrames").Indexed(false);
            configuration.Common.ObjectClass(typeof(Gallery)).ObjectField("expositions").Indexed(false);

            //configuration.Common.ObjectClass(typeof(Artist)).CallConstructor(true);
            configuration.Common.Queries.EvaluationMode(QueryEvaluationMode.Lazy);

            IObjectContainer db = Db4oEmbedded.OpenFile(configuration, pathToDbFile);

            try
            {
                //FillDatabase(db);
                ShowAllPaintings(db);
                PaintingsByArtist(db, new Artist("Artist1"));
                DaysOfPaintingInGallery(db, new Painting("Painting1_1", new Artist("Artist1")),
                                        new Gallery("Gallery1"));
                AmountOfPaintingsInGalleryDuringTimeFrame(db, new Gallery("Gallery3"),
                                                          new DateTime(2000, 04, 10), new DateTime(2000, 04, 12));
                MainArtists(db);
                AllPaintingsByGalleryMainArtistsInGalleryDuringTimeFrame(db,
                                                                         new Gallery("Gallery1"), new DateTime(2000, 04, 3), new DateTime(2000, 04, 4));
                AllGalleriesByArtist(db, new Artist("Artist3"));
                AllArtistsWithAtLeast10PaintingsDuringTimePeriodInGallery(db,
                                                                          new Gallery("Gallery1"), new DateTime(2000, 04, 10), new DateTime(2000, 04, 12));
                GalleriesWithPaintingsOfArtistDuringTimeframe(db, new Artist("Artist5"),
                                                              new DateTime(2000, 04, 3), new DateTime(2000, 04, 4));
                ArtistsWithPaintingsFromVariousGalleries(db);
            }
            finally
            {
                db.Close();
                log.Info("Press any key to continue...");
                Console.ReadKey();
            }
        }
コード例 #17
0
    private static IEmbeddedConfiguration NewConfiguration(IDiagnosticListener diagnosticCollector)
    {
        IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

        configuration.Common.Diagnostic.AddListener(diagnosticCollector);

        return(configuration);
    }
コード例 #18
0
        private IEmbeddedConfiguration NewConfiguration()
        {
            var config = Db4oEmbedded.NewConfiguration();

            config.Common.ObjectClass(typeof(TranslatedType
                                             ).FullName).Translate(new Translator());
            return(config);
        }
コード例 #19
0
ファイル: Db4oObjectCommandBase.cs プロジェクト: yuuhhe/db4o
        protected static IEmbeddedConfiguration Configure()
        {
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

            configuration.Common.ObjectClass(typeof(PSObject)).CallConstructor(true);
            configuration.Common.RegisterTypeHandler(new SingleClassTypeHandlerPredicate(typeof(PSObject)), new PSObjectTypeHandler());
            return(configuration);
        }
コード例 #20
0
ファイル: Program.cs プロジェクト: yuuhhe/db4o
        private static IEmbeddedConfiguration NewConfiguration()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.Add(new QueryMonitoringSupport());

            return(config);
        }
コード例 #21
0
        private IEmbeddedConfiguration NewConfiguration()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.ObjectClass(typeof(UnavailableClassesWithTranslatorTestCase.TranslatedType
                                             ).FullName).Translate(new UnavailableClassesWithTranslatorTestCase.Translator());
            return(config);
        }
コード例 #22
0
        public static void Main(string[] args)
        {
            // #example: Fix ASP.NET assembly names
            var config = Db4oEmbedded.NewConfiguration();

            config.Common.AddAlias(new AspAssemblyNamingFix());
            // #end example
        }
コード例 #23
0
        private void ConfigureAutoProperty()
        {
            // #example: Configure auto properties
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

            configuration.Common.ObjectClass(typeof(Person)).ObjectField("<Name>k__BackingField").Indexed(true);
            // #end example
        }
コード例 #24
0
ファイル: Persistence.cs プロジェクト: yuuhhe/db4o
        private static IEmbeddedConfiguration NewConfiguration()
        {
            var config = Db4oEmbedded.NewConfiguration();

            config.AddConfigurationItem(new SilverlightSupport());

            return(config);
        }
コード例 #25
0
ファイル: db4oClient.cs プロジェクト: pondyond/db4o
 public static void SetIndex(string fieldname, string className, bool isIndexed)
 {
     if (embeddedConfig == null)
     {
         embeddedConfig = Db4oEmbedded.NewConfiguration();
     }
     embeddedConfig.Common.ObjectClass(className).ObjectField(fieldname).Indexed(isIndexed);
 }
        public virtual void Test()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.File.Storage = storage;
            Assert.Expect(typeof(IncompatibleFileFormatException), new _ICodeBlock_36(config)
                          );
        }
コード例 #27
0
ファイル: Application.cs プロジェクト: git-thinh/limada
        private static IEmbeddedConfiguration Config()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.ActivationDepth = 0;
            config.Common.Add(new TransparentPersistenceSupport());
            return(config);
        }
コード例 #28
0
ファイル: App.xaml.cs プロジェクト: yuuhhe/db4o
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var cfg = Db4oEmbedded.NewConfiguration();

            cfg.AddConfigurationItem(new SilverlightSupport());
            container       = Db4oEmbedded.OpenFile(cfg, "database.db4o");
            this.RootVisual = new MainPage(container);
        }
コード例 #29
0
        private IObjectContainer OpenDatabase()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            Configure(config);

            return(Db4oEmbedded.OpenFile(config, TempFile()));
        }
コード例 #30
0
ファイル: AccessDB4O.cs プロジェクト: AdamKrzykala/DB4O
        public void dbOpen()
        {
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.ObjectClass(typeof(dbObjects.Draw)).CascadeOnUpdate(true);
            Console.WriteLine("Opening database");
            db = Db4oEmbedded.OpenFile(config, _path);
        }