Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Markup / Baml2006 / WpfSharedXamlSchemaContext.cs / 1305600 / WpfSharedXamlSchemaContext.cs
using System; using System.Collections.Generic; using System.Text; using System.Xaml; namespace System.Windows.Baml2006 { ////// This schema context is shared between all the WPF XAML loads in an AppDomain, including both /// full and partial trust callers. To be safe for sharing, it must be idempotent and order-independent. /// See the SecurityNote on XamlSchemaContext for more details. /// internal class WpfSharedXamlSchemaContext : WpfSharedBamlSchemaContext { // V3 Rules are: // Simple Collection rules: We only lookup IList & IDictionary (no add methods) (The MarkupCompiler doesn't support this) // No Deferring Loader lookup on XamlMember (The MarkupCompiler doesn't support this) public WpfSharedXamlSchemaContext(XamlSchemaContextSettings settings, bool useV3Rules) : base(settings) { _useV3Rules = useV3Rules; } public override XamlType GetXamlType(Type type) { if (type == null) { throw new ArgumentNullException("type"); } XamlType xType; lock (_syncObject) { if (!_masterTypeTable.TryGetValue(type, out xType)) { RequireRuntimeType(type); xType = CreateKnownBamlType(type.Name, false, _useV3Rules); if (xType == null || xType.UnderlyingType != type) { xType = new WpfXamlType(type, this, false /* isBamlType */, _useV3Rules); } _masterTypeTable.Add(type, xType); } } return xType; } internal static void RequireRuntimeType(Type type) { // To avoid injection of derived System.Types that lie about their identity // (and spoof other types), only allow RuntimeTypes. // S.W.M.XamlReader only supports live reflection, anyway. Type runtimeType = typeof(object).GetType(); if (!runtimeType.IsAssignableFrom(type.GetType())) { throw new ArgumentException(SR.Get(SRID.RuntimeTypeRequired, type), "type"); } } // Allow wrapping SchemaContexts a way to call into the protected overload of GetXamlType internal XamlType GetXamlTypeInternal(string xamlNamespace, string name, params XamlType[] typeArguments) { return base.GetXamlType(xamlNamespace, name, typeArguments); } private Dictionary_masterTypeTable = new Dictionary (); private object _syncObject = new Object(); private bool _useV3Rules; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.Generic; using System.Text; using System.Xaml; namespace System.Windows.Baml2006 { /// /// This schema context is shared between all the WPF XAML loads in an AppDomain, including both /// full and partial trust callers. To be safe for sharing, it must be idempotent and order-independent. /// See the SecurityNote on XamlSchemaContext for more details. /// internal class WpfSharedXamlSchemaContext : WpfSharedBamlSchemaContext { // V3 Rules are: // Simple Collection rules: We only lookup IList & IDictionary (no add methods) (The MarkupCompiler doesn't support this) // No Deferring Loader lookup on XamlMember (The MarkupCompiler doesn't support this) public WpfSharedXamlSchemaContext(XamlSchemaContextSettings settings, bool useV3Rules) : base(settings) { _useV3Rules = useV3Rules; } public override XamlType GetXamlType(Type type) { if (type == null) { throw new ArgumentNullException("type"); } XamlType xType; lock (_syncObject) { if (!_masterTypeTable.TryGetValue(type, out xType)) { RequireRuntimeType(type); xType = CreateKnownBamlType(type.Name, false, _useV3Rules); if (xType == null || xType.UnderlyingType != type) { xType = new WpfXamlType(type, this, false /* isBamlType */, _useV3Rules); } _masterTypeTable.Add(type, xType); } } return xType; } internal static void RequireRuntimeType(Type type) { // To avoid injection of derived System.Types that lie about their identity // (and spoof other types), only allow RuntimeTypes. // S.W.M.XamlReader only supports live reflection, anyway. Type runtimeType = typeof(object).GetType(); if (!runtimeType.IsAssignableFrom(type.GetType())) { throw new ArgumentException(SR.Get(SRID.RuntimeTypeRequired, type), "type"); } } // Allow wrapping SchemaContexts a way to call into the protected overload of GetXamlType internal XamlType GetXamlTypeInternal(string xamlNamespace, string name, params XamlType[] typeArguments) { return base.GetXamlType(xamlNamespace, name, typeArguments); } private Dictionary_masterTypeTable = new Dictionary (); private object _syncObject = new Object(); private bool _useV3Rules; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CustomErrorsSection.cs
- GridView.cs
- Scripts.cs
- BamlRecords.cs
- FilePrompt.cs
- FilterableAttribute.cs
- StretchValidation.cs
- TextContainerChangedEventArgs.cs
- FrameSecurityDescriptor.cs
- Menu.cs
- DetailsViewUpdateEventArgs.cs
- XamlToRtfParser.cs
- QueryCacheManager.cs
- VectorConverter.cs
- WebControlParameterProxy.cs
- CorrelationScope.cs
- GeneralTransform3D.cs
- ImageKeyConverter.cs
- ApplicationException.cs
- CustomError.cs
- CharacterBufferReference.cs
- SqlConnection.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- ArraySegment.cs
- XmlDeclaration.cs
- CommonRemoteMemoryBlock.cs
- Operators.cs
- IisTraceWebEventProvider.cs
- IdentityModelDictionary.cs
- PrivilegeNotHeldException.cs
- RenderOptions.cs
- GenerateHelper.cs
- CodeIdentifiers.cs
- StateWorkerRequest.cs
- Unit.cs
- GridViewPageEventArgs.cs
- RefreshPropertiesAttribute.cs
- JavaScriptString.cs
- Currency.cs
- ZipIOLocalFileDataDescriptor.cs
- SecurityTokenAuthenticator.cs
- StrokeNodeEnumerator.cs
- ItemCollection.cs
- HandleScope.cs
- ColorConverter.cs
- UnitySerializationHolder.cs
- securestring.cs
- TransformCryptoHandle.cs
- EventProviderWriter.cs
- Panel.cs
- COM2ExtendedBrowsingHandler.cs
- CheckBoxList.cs
- RoleGroup.cs
- MetadataItem_Static.cs
- RequestBringIntoViewEventArgs.cs
- Compensate.cs
- CalendarAutomationPeer.cs
- XmlTextReader.cs
- AsyncOperation.cs
- ConfigXmlAttribute.cs
- TdsParserStaticMethods.cs
- RelationshipManager.cs
- FunctionDefinition.cs
- DelegatingTypeDescriptionProvider.cs
- BasicHttpBinding.cs
- DbReferenceCollection.cs
- AppModelKnownContentFactory.cs
- PointKeyFrameCollection.cs
- DbMetaDataColumnNames.cs
- ReadOnlyActivityGlyph.cs
- SoapCodeExporter.cs
- BitStack.cs
- TableCell.cs
- VirtualDirectoryMappingCollection.cs
- ListViewCommandEventArgs.cs
- TdsParserSessionPool.cs
- OutputCache.cs
- UriParserTemplates.cs
- PropertyPathWorker.cs
- DeclarationUpdate.cs
- CommandDevice.cs
- DirtyTextRange.cs
- CustomErrorsSectionWrapper.cs
- ChangeToolStripParentVerb.cs
- StackBuilderSink.cs
- UniqueContractNameValidationBehavior.cs
- Rotation3D.cs
- InstancePersistenceCommand.cs
- CollectionDataContract.cs
- TextEndOfSegment.cs
- EllipticalNodeOperations.cs
- AnnotationDocumentPaginator.cs
- XmlSerializer.cs
- PersonalizableTypeEntry.cs
- Exception.cs
- NullExtension.cs
- WpfSharedXamlSchemaContext.cs
- WindowsScrollBarBits.cs
- path.cs
- ContextMenuAutomationPeer.cs