/// <summary>
        /// Adds a new <see cref="GroupDefinition"/> to the graph and returns the ID for that group.
        /// </summary>
        /// <param name="id">The ID of the group.</param>
        /// <param name="group">The group that should be added to the graph.</param>
        /// <returns>A task that will finish when the action has completed.</returns>
        public Task Add(GroupCompositionId id, GroupDefinition group)
        {
            var globalTask = Task.Factory.StartNew(
                () =>
            {
                var key = m_DatasetLock.LockForWriting();
                try
                {
                    m_CompositionLayer.Add(id, group);
                }
                finally
                {
                    m_DatasetLock.RemoveWriteLock(key);
                }
            });

            return(globalTask);
        }
Exemple #2
0
 /// <summary>
 /// Indicates that the dataset will be edited in the near future.
 /// </summary>
 /// <returns>A task which will complete once the dataset is ready for editing.</returns>
 public Task SwitchToEditMode()
 {
     return(Task.Factory.StartNew(
                () =>
     {
         var key = m_DatasetLock.LockForWriting();
         m_EditKeys.Push(key);
     },
                TaskCreationOptions.LongRunning));
 }