Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / Xml / System / Xml / Serialization / XmlSerializerFactory.cs / 1 / XmlSerializerFactory.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Serialization { using System.Reflection; using System.Collections; using System.IO; using System.Xml.Schema; using System; using System.Text; using System.Threading; using System.Globalization; using System.Security.Permissions; using System.Security.Policy; using System.Xml.Serialization.Configuration; using System.Diagnostics; using System.CodeDom.Compiler; ////// /// public class XmlSerializerFactory { static TempAssemblyCache cache = new TempAssemblyCache(); ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace) { return CreateSerializer(type, overrides, extraTypes, root, defaultNamespace, null, null); } ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(Type type, XmlRootAttribute root) { return CreateSerializer(type, null, new Type[0], root, null, null, null); } ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(Type type, Type[] extraTypes) { return CreateSerializer(type, null, extraTypes, null, null, null, null); } ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides) { return CreateSerializer(type, overrides, new Type[0], null, null, null, null); } ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(XmlTypeMapping xmlTypeMapping) { TempAssembly tempAssembly = XmlSerializer.GenerateTempAssembly(xmlTypeMapping); return (XmlSerializer)tempAssembly.Contract.TypedSerializers[xmlTypeMapping.Key]; } ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(Type type) { return CreateSerializer(type, (string)null); } ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(Type type, string defaultNamespace) { if (type == null) throw new ArgumentNullException("type"); TempAssembly tempAssembly = cache[defaultNamespace, type]; XmlTypeMapping mapping = null; if (tempAssembly == null) { lock (cache) { tempAssembly = cache[defaultNamespace, type]; if (tempAssembly == null) { XmlSerializerImplementation contract; Assembly assembly = TempAssembly.LoadGeneratedAssembly(type, defaultNamespace, out contract); if (assembly == null) { // need to reflect and generate new serialization assembly XmlReflectionImporter importer = new XmlReflectionImporter(defaultNamespace); mapping = importer.ImportTypeMapping(type, null, defaultNamespace); tempAssembly = XmlSerializer.GenerateTempAssembly(mapping, type, defaultNamespace); } else { tempAssembly = new TempAssembly(contract); } cache.Add(defaultNamespace, type, tempAssembly); } } } if (mapping == null) { mapping = XmlReflectionImporter.GetTopLevelMapping(type, defaultNamespace); } return (XmlSerializer)tempAssembly.Contract.GetSerializer(type); } ///[To be supplied.] ////// /// public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence) { if (type == null) throw new ArgumentNullException("type"); XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace); for (int i = 0; i < extraTypes.Length; i++) importer.IncludeType(extraTypes[i]); XmlTypeMapping mapping = importer.ImportTypeMapping(type, root, defaultNamespace); TempAssembly tempAssembly = XmlSerializer.GenerateTempAssembly(mapping, type, defaultNamespace, location, evidence); return (XmlSerializer)tempAssembly.Contract.TypedSerializers[mapping.Key]; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Single.cs
- ArrangedElement.cs
- EntityDataSourceUtil.cs
- InstanceKeyCompleteException.cs
- MappingException.cs
- JsonFaultDetail.cs
- XmlQueryStaticData.cs
- AmbientValueAttribute.cs
- UnsafeNativeMethodsCLR.cs
- QueryExpression.cs
- DocumentsTrace.cs
- Hashtable.cs
- XmlException.cs
- IxmlLineInfo.cs
- XmlSchemaInfo.cs
- XmlValueConverter.cs
- AuthorizationRuleCollection.cs
- HuffmanTree.cs
- TabControl.cs
- ToggleButtonAutomationPeer.cs
- LeftCellWrapper.cs
- DependencySource.cs
- Timeline.cs
- HelloMessageCD1.cs
- BindableAttribute.cs
- XmlSchemaProviderAttribute.cs
- RtfControlWordInfo.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- ComponentResourceManager.cs
- DataGridTable.cs
- FormViewPageEventArgs.cs
- complextypematerializer.cs
- IntegerValidatorAttribute.cs
- TypeHelper.cs
- SmiRecordBuffer.cs
- GridViewColumnHeaderAutomationPeer.cs
- ActivityInterfaces.cs
- DesignTimeTemplateParser.cs
- DataGridViewHitTestInfo.cs
- XPathNodeList.cs
- XmlSchemaIdentityConstraint.cs
- DataIdProcessor.cs
- ReferencedAssemblyResolver.cs
- InputReport.cs
- BeginStoryboard.cs
- MembershipSection.cs
- WebHeaderCollection.cs
- RefType.cs
- Stack.cs
- WebReferencesBuildProvider.cs
- PageSetupDialog.cs
- InitializerFacet.cs
- CalendarTable.cs
- UserPersonalizationStateInfo.cs
- ThemeDictionaryExtension.cs
- DateTimeFormatInfoScanner.cs
- SignatureHelper.cs
- WebServicesDescriptionAttribute.cs
- WebServiceMethodData.cs
- OracleCommandSet.cs
- SqlBuilder.cs
- QuaternionKeyFrameCollection.cs
- UnionCodeGroup.cs
- Trace.cs
- MergablePropertyAttribute.cs
- StyleSelector.cs
- QilLiteral.cs
- StrokeNodeOperations.cs
- wgx_commands.cs
- NullRuntimeConfig.cs
- DataRelation.cs
- DummyDataSource.cs
- RolePrincipal.cs
- MasterPageParser.cs
- PickBranch.cs
- GatewayDefinition.cs
- IInstanceTable.cs
- XslAst.cs
- FontUnit.cs
- FixedTextPointer.cs
- XmlDesigner.cs
- StringValueSerializer.cs
- ToolStripSeparatorRenderEventArgs.cs
- TypeSource.cs
- ConfigurationConverterBase.cs
- AuthorizationRuleCollection.cs
- NegatedCellConstant.cs
- SystemWebSectionGroup.cs
- ParameterReplacerVisitor.cs
- ComPlusThreadInitializer.cs
- Helpers.cs
- PagerSettings.cs
- WeakRefEnumerator.cs
- JoinGraph.cs
- PageThemeParser.cs
- SimpleMailWebEventProvider.cs
- XslTransformFileEditor.cs
- XmlSchemaSubstitutionGroup.cs
- Codec.cs
- TraceHandler.cs