public void ReleaseModel(IDomainModelState model, ReleaseAction releaseAction)
        {
            var proxy = DomainModelStateProxy.Unwrap(model);

            switch (releaseAction)
            {
                case ReleaseAction.AcceptChanges:
                    if (_nextState != proxy.Model)
                    {
                        throw new InvalidOperationException("Attempt to override current state detected.");
                    }

                    _currentState = _nextState;
                    _nextState = null;

                    _stateLock.ExitWriteLock();
                    break;

                case ReleaseAction.DiscardChanges:
                    break;

                default:
                    throw new ArgumentException(
                        string.Format("Invalid release action '{0}' specified.", releaseAction), "releaseAction");
            }

            proxy.Detach();

            _stateLock.ExitReadLock();
        }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ReleaseName.Length != 0)
            {
                hash ^= ReleaseName.GetHashCode();
            }
            if (ReleaseId != 0L)
            {
                hash ^= ReleaseId.GetHashCode();
            }
            if (ReleaseAction.Length != 0)
            {
                hash ^= ReleaseAction.GetHashCode();
            }
            if (TriggeredBy.Length != 0)
            {
                hash ^= TriggeredBy.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 3
0
 internal static void FireActionParsedEvent(ReleaseAction action)
 {
     ActionParsed?.Invoke(
         null,
         new ActionParsedEventArgs {
         DisplayName = action.DisplayName, ItemType = action.ItemType
     });
 }
Exemplo n.º 4
0
        private Result CreateSuccessResult <TLockCookie>(ISqlSynchronizationStrategy <TLockCookie> strategy, string lockName, TLockCookie lockCookie)
            where TLockCookie : class
        {
            var nonThreadSafeHandle = new ReleaseAction(() => this.ReleaseNoLock(strategy, lockName, lockCookie));
            var threadSafeHandle    = new ThreadSafeReleaseAction(this.mutex, nonThreadSafeHandle);

            this.outstandingHandles.Add(lockName, new HandleReference(threadSafeHandle: threadSafeHandle, nonThreadSafeHandle: nonThreadSafeHandle));
            return(new Result(threadSafeHandle));
        }
Exemplo n.º 5
0
 private static GenerationEventArgs GetActionGenerationArgs(ReleaseAction action, GenerationEventType eventType)
 {
     return(new GenerationEventArgs
     {
         BlockType = action.ItemType,
         DisplayName = action.DisplayName,
         Sequence = action.Sequence,
         IsEnabled = action.Enabled,
         IsContainer = false,
         GenerationEventType = eventType
     });
 }
 public static IRegistrationBuilder <TLimit, TActivatorData, TRegistrationStyle> OnRelease <TLimit, TActivatorData, TRegistrationStyle>(this IRegistrationBuilder <TLimit, TActivatorData, TRegistrationStyle> registration, Action <TLimit> releaseAction)
 {
     if (registration == null)
     {
         throw new ArgumentNullException("registration");
     }
     if (releaseAction == null)
     {
         throw new ArgumentNullException("releaseAction");
     }
     return(registration.ExternallyOwned().OnActivating(delegate(IActivatingEventArgs <TLimit> e) {
         ReleaseAction instance = new ReleaseAction(() => releaseAction(e.Instance));
         e.Context.Resolve <ILifetimeScope>().Disposer.AddInstanceForDisposal(instance);
     }));
 }
Exemplo n.º 7
0
 private static ScriptAction CreateScriptAction(RMComponent component, ReleaseAction action)
 {
     return(new ScriptAction
     {
         Enabled = action.Enabled,
         DisplayName = action.DisplayName,
         Sequence = action.Sequence,
         IsComponent = action.IsComponent,
         DeployerToolId = component.DeployerToolId,
         FileExtensionFilter = component.FileExtensionFilter,
         Command = component.Command,
         Arguments = component.Arguments,
         VariableReplacementMethod = component.VariableReplacementMethod,
         ConfigurationVariables = component.ConfigurationVariables
     });
 }
Exemplo n.º 8
0
        private static ReleaseAction ParseReleaseAction(XElement node)
        {
            var stageActivity       = XName.Get("StageActivity", "clr-namespace:Microsoft.TeamFoundation.Release.Data.Model;assembly=Microsoft.TeamFoundation.Release.Data");
            var firstNodeDescendant = node.Descendants(stageActivity).First();
            var componentId         = int.Parse(firstNodeDescendant.Attribute("ComponentId").Value);
            var workflowActivityId  = Guid.Parse(firstNodeDescendant.Attribute("WorkflowActivityId").Value);
            var itemType            = node.Name.LocalName == ActionActivity.LocalName
                ? BlockType.Action
                : node.Name.LocalName == ComponentActivity.LocalName ? BlockType.Component : BlockType.Undefined;

            var action = new ReleaseAction
            {
                DisplayName             = node.Attribute("DisplayName").Value,
                DisplayNameIsMeaningful = true,
                Enabled            = !bool.Parse(node.Attribute("IsSkipped").Value),
                ItemType           = itemType,
                ComponentId        = componentId,
                WorkflowActivityId = workflowActivityId
            };

            FireActionParsedEvent(action);

            return(action);
        }
Exemplo n.º 9
0
 public HandleReference(ThreadSafeReleaseAction threadSafeHandle, ReleaseAction nonThreadSafeHandle)
 {
     this.ThreadSafeHandle    = new WeakReference <ThreadSafeReleaseAction>(threadSafeHandle);
     this.NonThreadSafeHandle = nonThreadSafeHandle;
 }
Exemplo n.º 10
0
 private void Awake()
 {
     releaseAction = GetComponent <ReleaseAction>();
 }