public void TestInitialize() { base.Setup(); // Instanciate the manager only 1 time if (CouchBaseLiteLiteManager == null) { CouchBaseLiteLiteManager = Mvx.Resolve <ICouchBaseLite>(); } // Add Sqlite plugin register. Do it only for unit tests (https://github.com/CouchBaseLite/CouchBaseLite-lite-net/wiki/Error-Dictionary#cblcs0001) //CouchBaseLite.Lite.Storage.SystemSQLite.Plugin.Register(); entityRepo = new CouchBaseLiteRepository <TestEntity>(CouchBaseLiteLiteManager, dbName); entityRepo2 = new CouchBaseLiteRepository <TestEntity>(CouchBaseLiteLiteManager, dbName); collectionEntityRepo = new CouchBaseLiteRepository <CollectionTest>(CouchBaseLiteLiteManager, dbName); entityExtraEltRepo = new CouchBaseLiteRepository <TestExtraEltEntity>(CouchBaseLiteLiteManager, dbName); // Define mapping for polymorphism entityRepo.PolymorphicTypes["TestExtraEltEntity"] = typeof(TestExtraEltEntity); entityRepo2.PolymorphicTypes["TestExtraEltEntity"] = typeof(TestExtraEltEntity); test = new NoSQLCoreUnitTests(entityRepo, entityRepo2, entityExtraEltRepo, collectionEntityRepo, NoSQLCoreUnitTests.testContext.DeploymentDirectory, dbName); }
public BookStorage(IPlatformInfo platform, ICouchBaseLite couchbase, ISettingsService settingsService) { // Connect to the database couchbase.Initialize(platform.BaseDirectory); var options = couchbase.CreateDatabaseOptions(); options.Create = true; m_DataBase = couchbase.CreateConnection("bookscouchdb", options); m_SettingsService = settingsService; }
private void Construct(ICouchBaseLite CouchBaseLiteLite, StorageTypes storage, string dbName) { if (CouchBaseLiteLite == null) { throw new ArgumentNullException("CouchBaseLiteLite"); } this.CouchBaseLiteLite = CouchBaseLiteLite; this.CollectionName = typeof(T).Name; ConnectToDatabase(storage, dbName); CreateAllDocView(); }
/// <summary> /// Constructor /// </summary> /// <param name="CouchBaseLiteLite"></param> /// <param name="fileStore"></param> public CouchBaseLiteRepository(ICouchBaseLite CouchBaseLiteLite, StorageTypes storage, string dbName) { Construct(CouchBaseLiteLite, storage, dbName); }