Esempio n. 1
0
		/// <summary>
		/// Creates embeddable instance of document changes
		/// </summary>
		/// <param name="database">Database name is ignored in embeddable document store</param>
		protected override IDatabaseChanges CreateDatabaseChanges(string database)
		{
			IDatabaseChanges result = null;
			result = new EmbeddableDatabaseChanges(this, () => result = null, ((EmbeddedDatabaseCommands)  DatabaseCommands).TryResolveConflictByUsingRegisteredListeners);
			return result;
		}
		/// <summary>
		/// Subscribe to change notifications from the server
		/// </summary>
		public override IDatabaseChanges Changes(string database = null)
		{
			if(string.IsNullOrEmpty(Url) == false)
				return base.Changes(database);

			if(database != null)
				throw new NotSupportedException("Embedded document store does not support multi tenancy");

			if(databaseChanges == null)
			{
				lock(this)
				{
					Thread.MemoryBarrier();
					if(databaseChanges == null)
						databaseChanges = new EmbeddableDatabaseChanges(this, () => databaseChanges = null);
				}
			}
			return databaseChanges;
		}
		/// <summary>
		/// Creates embeddable instance of document changes
		/// </summary>
		/// <param name="database">Database name is ignored in embeddable document store</param>
		protected override IDatabaseChanges CreateDatabaseChanges(string database)
		{
			IDatabaseChanges result = null;
			result = new EmbeddableDatabaseChanges(this, () => result = null);
			return result;
		}