private IEmbeddedConfiguration Config() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.File.Storage = new MemoryStorage(); return(config); }
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 } }
private IObjectContainer OpenObjectContainer(bool lockDatabaseFile) { var config = Db4oEmbedded.NewConfiguration(); config.File.LockDatabaseFile = lockDatabaseFile; return(Db4oEmbedded.OpenFile(config, TempFile())); }
protected virtual IEmbeddedConfiguration NewConfiguration() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.AddConfigurationItem(new SilverlightSupport()); return(config); }
private IObjectContainer NewInstance() { var configuration = Db4oEmbedded.NewConfiguration(); configuration.File.Storage = fileSystem; return(Db4oEmbedded.OpenFile(configuration, "!In:Memory")); }
private IEmbeddedConfiguration ConfigWith(IReflector reflector) { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.Common.ReflectWith(reflector); return(config); }
private IEmbeddedConfiguration ReadOnlyConfiguration() { IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.File.ReadOnly = true; return(configuration); }
private static IEmbeddedConfiguration Config() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.File.Storage = new IsolatedStorageStorage(); return(config); }
public virtual void Open() { var config = Db4oEmbedded.NewConfiguration(); config.File.Storage = new MemoryStorage(); _server = Db4oEmbedded.OpenFile(config, string.Empty); }
private IEmbeddedObjectContainer OpenDatabase() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.File.Storage = _storage; return(Db4oEmbedded.OpenFile(config, DatabaseFileName)); }
private static IEmbeddedConfiguration NewEmbeddedConfiguration(IConfigurationItem support) { var config = Db4oEmbedded.NewConfiguration(); config.Common.Add(support); return(config); }
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); }
public virtual void Test() { IEmbeddedConfiguration embeddedConfiguration = Db4oEmbedded.NewConfiguration(); Assert.Expect(typeof(ArgumentException), new _ICodeBlock_14(embeddedConfiguration )); }
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(); } }
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); }
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(); } }
private static IEmbeddedConfiguration NewConfiguration(IDiagnosticListener diagnosticCollector) { IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.Common.Diagnostic.AddListener(diagnosticCollector); return(configuration); }
private IEmbeddedConfiguration NewConfiguration() { var config = Db4oEmbedded.NewConfiguration(); config.Common.ObjectClass(typeof(TranslatedType ).FullName).Translate(new Translator()); return(config); }
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); }
private static IEmbeddedConfiguration NewConfiguration() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.Common.Add(new QueryMonitoringSupport()); return(config); }
private IEmbeddedConfiguration NewConfiguration() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.Common.ObjectClass(typeof(UnavailableClassesWithTranslatorTestCase.TranslatedType ).FullName).Translate(new UnavailableClassesWithTranslatorTestCase.Translator()); return(config); }
public static void Main(string[] args) { // #example: Fix ASP.NET assembly names var config = Db4oEmbedded.NewConfiguration(); config.Common.AddAlias(new AspAssemblyNamingFix()); // #end example }
private void ConfigureAutoProperty() { // #example: Configure auto properties IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration(); configuration.Common.ObjectClass(typeof(Person)).ObjectField("<Name>k__BackingField").Indexed(true); // #end example }
private static IEmbeddedConfiguration NewConfiguration() { var config = Db4oEmbedded.NewConfiguration(); config.AddConfigurationItem(new SilverlightSupport()); return(config); }
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) ); }
private static IEmbeddedConfiguration Config() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.Common.ActivationDepth = 0; config.Common.Add(new TransparentPersistenceSupport()); return(config); }
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); }
private IObjectContainer OpenDatabase() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); Configure(config); return(Db4oEmbedded.OpenFile(config, TempFile())); }
public void dbOpen() { IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration(); config.Common.ObjectClass(typeof(dbObjects.Draw)).CascadeOnUpdate(true); Console.WriteLine("Opening database"); db = Db4oEmbedded.OpenFile(config, _path); }