Beispiel #1
0
        protected void Setup()
        {
            if (DataStore == null)
            {
                string          backend = File.ReadAllText("../../../backend.txt").Trim();
                IStorageService storageService;

                if (backend == "postgres")
                {
                    storageService = new PostgresStorageService(new PostgresStorageOptions
                    {
                        Connect = "Server=/run/postgresql; Port=5432; Database=postgres; User Id=datastoretest"
                    });
                }
                else
                {
                    storageService = new FirestoreStorageService(new FirestoreStorageOptions
                    {
                        CredentialFile = "../../../../googleKeyfile.json",
                        Prefix         = "datastore"
                    });
                }

                DataStore = new DataStore(storageService);
                Accounts  = DataStore.AddCollection <Account>("account");
                DataStore.AddCollection <Contact>("contact");
                Contacts = DataStore.GetCollection <Contact>();
            }
        }