Exemple #1
0
        /// <constructor />
        public CouchSession(string databaseName, Settings settings, ICouchApi couchApi)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (settings.Incomplete)
            {
                throw new ArgumentException("Settings are incomplete.", "settings");
            }
            if (databaseName.HasNoValue())
            {
                throw new ArgumentNullException("databaseName");
            }
            if (couchApi == null)
            {
                throw new ArgumentNullException("couchApi");
            }


            this.settings = settings;
            this.couchApi = couchApi;
            databaseApi   = couchApi.Db(databaseName);
            unitOfWork    = new SessionUnitOfWork(settings);
            Synchronously = new SynchronousSessionMethods(this);
        }
Exemple #2
0
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (couchApi != null)
         {
             couchApi.Dispose();
             couchApi = null;
         }
         if (unitOfWork != null)
         {
             unitOfWork.Clear();
         }
     }
 }
		private static void CreateDatabases(ICouchApi couchApi, IEnumerable<string> databasesToReplicate)
		{
			foreach (var dbApi in databasesToReplicate.Select(couchApi.Db))
				try
				{
					dbApi.Synchronously.Create();
				}
				catch (CouchCommunicationException e)
				{
					// i.e. database file is already exists meannig it have been concurrently created, witch in case is possible
					// if DB data is stored in CloudDrive or if we running on dev fabric
					if (!e.Message.Contains("file_exists"))
						throw;
				}
		}
 /// <constructor />
 public SynchronousCouchApi(ICouchApi couchApi)
 {
     this.couchApi = couchApi;
 }
Exemple #5
0
 /// <constructor />
 public SynchronousCouchApi(ICouchApi couchApi)
 {
     this.couchApi = couchApi;
 }
Exemple #6
0
 /// <constructor />
 public CouchSession(Settings settings, ICouchApi couchApi)
     : this(settings != null? settings.DefaultDatabaseName: null, settings, couchApi)
 {
 }