Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / ServiceModel / Configuration / WorkflowRuntimeElement.cs / 1305376 / WorkflowRuntimeElement.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.ServiceModel.Description;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Configuration;
public class WorkflowRuntimeElement : BehaviorExtensionElement
{
const string cachedInstanceExpiration = "cachedInstanceExpiration";
const string commonParameters = "commonParameters";
const string enablePerfCounters = "enablePerformanceCounters";
const string name = "name";
const string services = "services";
const string validateOnCreate = "validateOnCreate";
ConfigurationPropertyCollection configProperties = null;
WorkflowRuntimeSection wrtSection = null;
public WorkflowRuntimeElement()
{
}
// This property is not supposed to be exposed in config.
[SuppressMessage("Configuration", "Configuration102:ConfigurationPropertyAttributeRule", MessageId = "System.ServiceModel.Configuration.WorkflowRuntimeElement.BehaviorType")]
public override Type BehaviorType
{
get
{
return typeof(WorkflowRuntimeBehavior);
}
}
[ConfigurationProperty(cachedInstanceExpiration, IsRequired = false, DefaultValue = WorkflowRuntimeBehavior.DefaultCachedInstanceExpirationString)]
[TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
[PositiveTimeSpanValidator]
public TimeSpan CachedInstanceExpiration
{
get
{
return (TimeSpan) base[cachedInstanceExpiration];
}
set
{
base[cachedInstanceExpiration] = value;
}
}
[ConfigurationProperty(commonParameters, DefaultValue = null)]
public NameValueConfigurationCollection CommonParameters
{
get
{
return (NameValueConfigurationCollection) base[commonParameters];
}
}
[ConfigurationProperty(enablePerfCounters, DefaultValue = true)]
public bool EnablePerformanceCounters
{
get
{
return (bool) base[enablePerfCounters];
}
set
{
base[enablePerfCounters] = value;
}
}
[ConfigurationProperty(name, DefaultValue = "")]
[StringValidator(MinLength = 0)]
public string Name
{
get
{
return (string) base[name];
}
set
{
base[name] = value;
}
}
[ConfigurationProperty(services, DefaultValue = null)]
public ExtendedWorkflowRuntimeServiceElementCollection Services
{
get
{
return (ExtendedWorkflowRuntimeServiceElementCollection) base[services];
}
}
[ConfigurationProperty(validateOnCreate, DefaultValue = WorkflowRuntimeBehavior.DefaultValidateOnCreate)]
public bool ValidateOnCreate
{
get
{
return (bool) base[validateOnCreate];
}
set
{
base[validateOnCreate] = value;
}
}
protected override ConfigurationPropertyCollection Properties
{
get
{
if (this.configProperties == null)
{
this.configProperties = new ConfigurationPropertyCollection();
configProperties.Add(new ConfigurationProperty(name, typeof(string), null));
configProperties.Add(new ConfigurationProperty(validateOnCreate, typeof(bool), true));
configProperties.Add(new ConfigurationProperty(enablePerfCounters, typeof(bool), true));
configProperties.Add(new ConfigurationProperty(services, typeof(ExtendedWorkflowRuntimeServiceElementCollection), null));
configProperties.Add(new ConfigurationProperty(commonParameters, typeof(NameValueConfigurationCollection), null));
configProperties.Add(new ConfigurationProperty(cachedInstanceExpiration, typeof(TimeSpan), WorkflowRuntimeBehavior.DefaultCachedInstanceExpiration));
}
return this.configProperties;
}
}
protected internal override object CreateBehavior()
{
return new WorkflowRuntimeBehavior(new WorkflowRuntime(CreateWorkflowRuntimeSection()), this.CachedInstanceExpiration, this.ValidateOnCreate);
}
WorkflowRuntimeSection CreateWorkflowRuntimeSection()
{
if (wrtSection == null)
{
wrtSection = new WorkflowRuntimeSection();
wrtSection.Name = this.Name;
wrtSection.ValidateOnCreate = false;
wrtSection.EnablePerformanceCounters = this.EnablePerformanceCounters;
foreach (WorkflowRuntimeServiceElement wrtSvcElement in this.Services)
{
wrtSection.Services.Add(wrtSvcElement);
}
foreach (NameValueConfigurationElement nameValueElement in this.CommonParameters)
{
wrtSection.CommonParameters.Add(nameValueElement);
}
}
return wrtSection;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MdImport.cs
- NotFiniteNumberException.cs
- BlockUIContainer.cs
- TcpStreams.cs
- HMACSHA384.cs
- MarkupObject.cs
- SplineQuaternionKeyFrame.cs
- AsymmetricKeyExchangeDeformatter.cs
- CompensableActivity.cs
- WebEvents.cs
- NonSerializedAttribute.cs
- Image.cs
- WinFormsSecurity.cs
- _HeaderInfo.cs
- ProtocolsConfigurationHandler.cs
- TreeViewItem.cs
- JsonReader.cs
- ExpressionPrefixAttribute.cs
- DataService.cs
- PerfCounters.cs
- DataViewSetting.cs
- EventSourceCreationData.cs
- HierarchicalDataTemplate.cs
- PathSegmentCollection.cs
- ListViewGroup.cs
- EntitySet.cs
- Imaging.cs
- TransactionInformation.cs
- AsyncOperation.cs
- TemporaryBitmapFile.cs
- SqlDataSourceQueryEditorForm.cs
- ArcSegment.cs
- ClientSponsor.cs
- SoapElementAttribute.cs
- Camera.cs
- XsltFunctions.cs
- SimpleBitVector32.cs
- CategoryList.cs
- X509ChainElement.cs
- DataGridColumn.cs
- CopyOfAction.cs
- ToolStripItemTextRenderEventArgs.cs
- XmlBinaryWriter.cs
- Pts.cs
- ArgumentNullException.cs
- InputProviderSite.cs
- DataGridCellsPanel.cs
- QueryAccessibilityHelpEvent.cs
- Ipv6Element.cs
- SmtpDigestAuthenticationModule.cs
- PreviewPrintController.cs
- Module.cs
- Console.cs
- ArglessEventHandlerProxy.cs
- UInt64Storage.cs
- Grant.cs
- ArrayMergeHelper.cs
- OrderByBuilder.cs
- DBSchemaTable.cs
- EnumValidator.cs
- NeutralResourcesLanguageAttribute.cs
- WorkflowRuntimeService.cs
- OperationCanceledException.cs
- ToolbarAUtomationPeer.cs
- PathData.cs
- EntityWrapper.cs
- SerializationInfo.cs
- XXXOnTypeBuilderInstantiation.cs
- VSWCFServiceContractGenerator.cs
- SwitchCase.cs
- MailAddressCollection.cs
- SmtpLoginAuthenticationModule.cs
- Identity.cs
- HMACSHA256.cs
- HuffCodec.cs
- FigureHelper.cs
- TableDesigner.cs
- TableCell.cs
- TableLayoutSettings.cs
- EntityContainerAssociationSetEnd.cs
- SmiMetaData.cs
- Cursor.cs
- UrlMapping.cs
- SmtpNtlmAuthenticationModule.cs
- _AutoWebProxyScriptHelper.cs
- Pen.cs
- LabelEditEvent.cs
- Attributes.cs
- Registration.cs
- ClientBase.cs
- RawKeyboardInputReport.cs
- CompiledRegexRunnerFactory.cs
- UInt32Converter.cs
- LogicalTreeHelper.cs
- MappingModelBuildProvider.cs
- WindowsEditBox.cs
- UIElement.cs
- KeyProperty.cs
- oledbmetadatacollectionnames.cs
- DynamicRendererThreadManager.cs