Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / Configuration / DeclaredTypeElement.cs / 1305376 / DeclaredTypeElement.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime.Serialization.Configuration
{
using System;
using System.Configuration;
using System.Security.Permissions;
using System.Security;
public sealed partial class DeclaredTypeElement : ConfigurationElement
{
public DeclaredTypeElement()
{
}
public DeclaredTypeElement(string typeName) : this()
{
if (String.IsNullOrEmpty(typeName))
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeName");
}
this.Type = typeName;
}
[ConfigurationProperty(ConfigurationStrings.DefaultCollectionName, DefaultValue = null, Options = ConfigurationPropertyOptions.IsDefaultCollection)]
public TypeElementCollection KnownTypes
{
get { return (TypeElementCollection)base[ConfigurationStrings.DefaultCollectionName]; }
}
[ConfigurationProperty(ConfigurationStrings.Type, DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
[DeclaredTypeValidator()]
public string Type
{
get { return (string)base[ConfigurationStrings.Type]; }
set { base[ConfigurationStrings.Type] = value; }
}
[Fx.Tag.SecurityNote(Critical = "Calls the critical methods of PartialTrustHelpers",
Safe = "PartialTrustHelpers.IsInFullTrust demands for FullTrust")]
[SecuritySafeCritical]
protected override void PostDeserialize()
{
// Perf optimization. If the configuration is coming from machine.config
// It is safe and we don't need to check for permissions.
if (EvaluationContext.IsMachineLevel)
{
return;
}
if(!PartialTrustHelpers.IsInFullTrust())
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigDataContractSerializerSectionLoadError)));
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime.Serialization.Configuration
{
using System;
using System.Configuration;
using System.Security.Permissions;
using System.Security;
public sealed partial class DeclaredTypeElement : ConfigurationElement
{
public DeclaredTypeElement()
{
}
public DeclaredTypeElement(string typeName) : this()
{
if (String.IsNullOrEmpty(typeName))
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("typeName");
}
this.Type = typeName;
}
[ConfigurationProperty(ConfigurationStrings.DefaultCollectionName, DefaultValue = null, Options = ConfigurationPropertyOptions.IsDefaultCollection)]
public TypeElementCollection KnownTypes
{
get { return (TypeElementCollection)base[ConfigurationStrings.DefaultCollectionName]; }
}
[ConfigurationProperty(ConfigurationStrings.Type, DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
[DeclaredTypeValidator()]
public string Type
{
get { return (string)base[ConfigurationStrings.Type]; }
set { base[ConfigurationStrings.Type] = value; }
}
[Fx.Tag.SecurityNote(Critical = "Calls the critical methods of PartialTrustHelpers",
Safe = "PartialTrustHelpers.IsInFullTrust demands for FullTrust")]
[SecuritySafeCritical]
protected override void PostDeserialize()
{
// Perf optimization. If the configuration is coming from machine.config
// It is safe and we don't need to check for permissions.
if (EvaluationContext.IsMachineLevel)
{
return;
}
if(!PartialTrustHelpers.IsInFullTrust())
{
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigDataContractSerializerSectionLoadError)));
}
}
}
}
// 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
- RegexFCD.cs
- UriParserTemplates.cs
- NoPersistScope.cs
- DataGridItemEventArgs.cs
- NameTable.cs
- IList.cs
- StreamGeometry.cs
- mda.cs
- WebPartMenuStyle.cs
- XsltSettings.cs
- CompiledRegexRunnerFactory.cs
- AdRotator.cs
- ImageUrlEditor.cs
- ServiceBuildProvider.cs
- XmlDocument.cs
- Msmq3PoisonHandler.cs
- WindowInteractionStateTracker.cs
- ModelVisual3D.cs
- RegionData.cs
- RemoteAsymmetricSignatureFormatter.cs
- DesignerAttribute.cs
- SerialReceived.cs
- ClaimTypeRequirement.cs
- PermissionSetTriple.cs
- AlgoModule.cs
- ReferencedCategoriesDocument.cs
- GridViewColumnCollection.cs
- RtfToXamlReader.cs
- ImageFormat.cs
- MutableAssemblyCacheEntry.cs
- EmptyEnumerator.cs
- AssociationType.cs
- StatusBar.cs
- QilName.cs
- XmlWriter.cs
- UserMapPath.cs
- FlowStep.cs
- QuestionEventArgs.cs
- _SslState.cs
- IISUnsafeMethods.cs
- Activation.cs
- PerspectiveCamera.cs
- MetadataItem_Static.cs
- HttpRawResponse.cs
- ServiceNameElement.cs
- Int32Storage.cs
- BasicViewGenerator.cs
- DynamicQueryableWrapper.cs
- Attributes.cs
- LeaseManager.cs
- CompoundFileStorageReference.cs
- ZipIOLocalFileHeader.cs
- TreeNodeConverter.cs
- Socket.cs
- TemplateApplicationHelper.cs
- PropertySourceInfo.cs
- MethodBuilder.cs
- Matrix3DConverter.cs
- SqlNamer.cs
- SchemaAttDef.cs
- StoragePropertyMapping.cs
- TextOutput.cs
- ContentElement.cs
- PointLight.cs
- AtomContentProperty.cs
- ActivityXamlServices.cs
- EventRouteFactory.cs
- TriggerActionCollection.cs
- Binding.cs
- AsyncOperation.cs
- VisualStyleElement.cs
- DataTableMapping.cs
- ConsoleTraceListener.cs
- SQLBoolean.cs
- ScrollProperties.cs
- XmlSignatureManifest.cs
- hresults.cs
- SelectionProviderWrapper.cs
- DocumentScope.cs
- GACIdentityPermission.cs
- MatrixTransform.cs
- TypeConverter.cs
- Avt.cs
- Trigger.cs
- CultureTableRecord.cs
- ComplexTypeEmitter.cs
- CultureSpecificStringDictionary.cs
- AnimationLayer.cs
- CultureInfo.cs
- TraceHandlerErrorFormatter.cs
- VectorAnimation.cs
- DispatchChannelSink.cs
- StopStoryboard.cs
- IISMapPath.cs
- StylusCaptureWithinProperty.cs
- CompositeActivityCodeGenerator.cs
- RelationshipDetailsCollection.cs
- ElementsClipboardData.cs
- SQLDateTimeStorage.cs
- TimeManager.cs