Esempio n. 1
0
        private AsyncUpdateEvent Remove(AsyncUpdateDelegate @delegate)
        {
            if (@delegate == null)
            {
                throw new ArgumentNullException(nameof(@delegate));
            }

            delegates.Remove(@delegate);
            return(this);
        }
        /// <summary>
        /// Updates a store asynchronously
        /// </summary>
        /// <param name="storage">Storage Provider</param>
        /// <param name="updates">SPARQL Update</param>
        /// <param name="callback">Callback</param>
        /// <param name="state">State to pass to the callback</param>
        internal static void AsyncUpdate(this IUpdateableStorage storage, String updates, AsyncStorageCallback callback, Object state)
        {
            AsyncUpdateDelegate d = new AsyncUpdateDelegate(Update);

            d.BeginInvoke(storage, updates, r =>
            {
                try
                {
                    d.EndInvoke(r);
                    callback(storage, new AsyncStorageCallbackArgs(AsyncStorageOperation.SparqlUpdate, updates), state);
                }
                catch (Exception e)
                {
                    callback(storage, new AsyncStorageCallbackArgs(AsyncStorageOperation.SparqlUpdate, updates, e), state);
                }
            }, state);
        }