当前位置: 首页>>代码示例>>C#>>正文


C# StateType.ToString方法代码示例

本文整理汇总了C#中StateType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# StateType.ToString方法的具体用法?C# StateType.ToString怎么用?C# StateType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StateType的用法示例。


在下文中一共展示了StateType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetNameAndVersion

            /// <summary>
            /// Get the unique state name for the given {type, analyzer} tuple.
            /// Note that this name is used by the underlying persistence stream of the corresponding <see cref="DiagnosticState"/> to Read/Write diagnostic data into the stream.
            /// If any two distinct {type, analyzer} tuples have the same diagnostic state name, we will end up sharing the persistence stream between them, leading to duplicate/missing/incorrect diagnostic data.
            /// </summary>
            private static ValueTuple<string, VersionStamp> GetNameAndVersion(DiagnosticAnalyzer analyzer, StateType type)
            {
                Contract.ThrowIfNull(analyzer);

                // Get the unique ID for given diagnostic analyzer.
                // note that we also put version stamp so that we can detect changed analyzer.
                var tuple = analyzer.GetAnalyzerIdAndVersion();
                return ValueTuple.Create(UserDiagnosticsPrefixTableName + "_" + type.ToString() + "_" + tuple.Item1, tuple.Item2);
            }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:14,代码来源:DiagnosticIncrementalAnalyzer.StateSet.cs

示例2: DispatchDebugState

        public void DispatchDebugState(IDSFDataObject dataObject, StateType stateType, bool hasErrors, string existingErrors, out ErrorResultTO errors, DateTime? workflowStartTime = null, bool interrogateInputs = false, bool interrogateOutputs = false)
        {
            errors = new ErrorResultTO();
            if(dataObject != null)
            {
                Guid parentInstanceId;
                Guid.TryParse(dataObject.ParentInstanceID, out parentInstanceId);
                IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
                bool hasError = dataObject.Environment.HasErrors();
                var errorMessage = String.Empty;
                if(hasError)
                {
                    errorMessage = dataObject.Environment.FetchErrors();
                }
                if(String.IsNullOrEmpty(existingErrors))
                {
                    existingErrors = errorMessage;
                }
                else
                {
                    existingErrors += Environment.NewLine + errorMessage;
                }
                var debugState = new DebugState
                {
                    ID = dataObject.OriginalInstanceID,
                    ParentID = parentInstanceId,
                    WorkspaceID = dataObject.WorkspaceID,
                    StateType = stateType,
                    StartTime = workflowStartTime ?? DateTime.Now,
                    EndTime = DateTime.Now,
                    ActivityType = ActivityType.Workflow,
                    DisplayName = dataObject.ServiceName,
                    IsSimulation = dataObject.IsOnDemandSimulation,
                    ServerID = dataObject.ServerID,
                    OriginatingResourceID = dataObject.ResourceID,
                    OriginalInstanceID = dataObject.OriginalInstanceID,
                    Server = string.Empty,
                    Version = string.Empty,
                    SessionID = dataObject.DebugSessionID,
                    EnvironmentID = dataObject.EnvironmentID,
                    ClientID = dataObject.ClientID,
                    Name = stateType.ToString(),
                    HasError = hasErrors || hasError,
                    ErrorMessage = existingErrors
                };

                if(interrogateInputs)
                {
                    ErrorResultTO invokeErrors;
                    var defs = compiler.GenerateDefsFromDataListForDebug(FindServiceShape(dataObject.WorkspaceID, dataObject.ResourceID), enDev2ColumnArgumentDirection.Input);
                    var inputs = GetDebugValues(defs, dataObject, out invokeErrors);
                    errors.MergeErrors(invokeErrors);
                    debugState.Inputs.AddRange(inputs);
                }
                if(interrogateOutputs)
                {
                    ErrorResultTO invokeErrors;
                    
                    var defs = compiler.GenerateDefsFromDataListForDebug(FindServiceShape(dataObject.WorkspaceID, dataObject.ResourceID), enDev2ColumnArgumentDirection.Output);
                    var inputs = GetDebugValues(defs, dataObject, out invokeErrors);
                    errors.MergeErrors(invokeErrors);
                    debugState.Outputs.AddRange(inputs);
                }
                if(stateType == StateType.End)
                {
                    debugState.NumberOfSteps = dataObject.NumberOfSteps;
                }

                if(stateType == StateType.Start)
                {
                    debugState.ExecutionOrigin = dataObject.ExecutionOrigin;
                    debugState.ExecutionOriginDescription = dataObject.ExecutionOriginDescription;
                }

                if(dataObject.IsDebugMode() || (dataObject.RunWorkflowAsync && !dataObject.IsFromWebServer))
                {
                    var debugDispatcher = GetDebugDispatcher();
                    if(debugState.StateType == StateType.End)
                    {
                        while(!debugDispatcher.IsQueueEmpty)
                        {
                            Thread.Sleep(100);
                        }
                        debugDispatcher.Write(debugState, dataObject.RemoteInvoke, dataObject.RemoteInvokerID, dataObject.ParentInstanceID, dataObject.RemoteDebugItems);
                    }
                    else
                    {
                        debugDispatcher.Write(debugState);
                    }
                }
            }
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:92,代码来源:WFApplicationUtils.cs

示例3: GetUniqueDiagnosticStateNameAndVersion

            /// <summary>
            /// Get the unique state name for the given {type, provider} tuple.
            /// Note that this name is used by the underlying persistence stream of the corresponding <see cref="DiagnosticState"/> to Read/Write diagnostic data into the stream.
            /// If any two distinct {type, provider} tuples have the same diagnostic state name, we will end up sharing the persistence stream between them, leading to duplicate/missing/incorrect diagnostic data.
            /// </summary>
            private static ValueTuple<string, VersionStamp> GetUniqueDiagnosticStateNameAndVersion(StateType type, ProviderId providerId, DiagnosticAnalyzer provider)
            {
                Contract.ThrowIfNull(provider);

                // Get the unique ID for given diagnostic analyzer.
                // note that we also put version stamp so that we can detect changed provider
                var providerType = provider.GetType();
                var location = providerType.Assembly.Location;

                return ValueTuple.Create(UserDiagnosticsPrefixTableName + "_" + type.ToString() + "_" + providerType.AssemblyQualifiedName, GetProviderVersion(location));
            }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:16,代码来源:DiagnosticIncrementalAnalyzer.DiagnosticAnalyzersAndStates.cs


注:本文中的StateType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。