public void InitStore(EventStoreTypes type) { //this.EventStoreType = type.ToString(); switch (type) { case EventStoreTypes.None: store = new NullEventStore(); break; case EventStoreTypes.Xml: storeFile = FsUtil.GetCurrentUserAppDataFolder() + "EventStore.xml"; store = new EventStore(); if (File.Exists(storeFile)) { FileInfo info = new FileInfo(storeFile); if (info.IsReadOnly) { throw new EventStoreInitializationException(storeFile); } store.Hydrate(storeFile); } break; case EventStoreTypes.MSSql: store = new DatabaseEventStore(DaoDbType.MSSql); try { DatabaseAgent.GetAgent(LogEventData.ContextName, DaoDbType.MSSql).EnsureSchema <EventDefinition>(); } catch { // we tried } break; case EventStoreTypes.SQLite: store = new DatabaseEventStore(DaoDbType.SQLite); try { DatabaseAgent.GetAgent(LogEventData.ContextName, DaoDbType.SQLite).EnsureSchema <EventDefinition>(); } catch (UnableToDetermineConnectionStringException utdcse) { //AppDb.Current; } catch { //we tried } break; } }
private DatabaseAgent GetAgent(DaoDbType type) { return(DatabaseAgent.GetAgent(LogEventData.ContextName, type)); }
private DatabaseAgent GetAgent() { return(DatabaseAgent.GetAgent(EventDefinition.ContextName, this.DaoDbType)); }