Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / data / design / ExtendedPropertiesHandler.cs / 1 / ExtendedPropertiesHandler.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All Rights Reserved. // Information Contained Herein is Proprietary and Confidential. // //----------------------------------------------------------------------------- namespace System.Data.Design { using System; using System.CodeDom; using System.Collections; using System.ComponentModel; using System.Data; using System.Design; internal sealed class ExtendedPropertiesHandler { private static TypedDataSourceCodeGenerator codeGenerator = null; private static DataSourceComponent targetObject = null; // private constructor to avoid class being instantiated. private ExtendedPropertiesHandler() { } internal static TypedDataSourceCodeGenerator CodeGenerator { set { codeGenerator = value; } } internal static void AddExtendedProperties(DataSourceComponent targetObj, CodeExpression addTarget, IList statementCollection, Hashtable extendedProperties) { if(extendedProperties == null) { return; } if (addTarget == null) { throw new InternalException("ExtendedPropertiesHandler.AddExtendedProperties: addTarget cannot be null"); } if (statementCollection == null) { throw new InternalException("ExtendedPropertiesHandler.AddExtendedProperties: statementCollection cannot be null"); } if (codeGenerator == null) { throw new InternalException("ExtendedPropertiesHandler.AddExtendedProperties: codeGenerator cannot be null"); } if (targetObj == null) { throw new InternalException("ExtendedPropertiesHandler.AddExtendedProperties: targetObject cannot be null"); } targetObject = targetObj; if(codeGenerator.GenerateExtendedProperties) { GenerateProperties(addTarget, statementCollection, extendedProperties); } else { // Generating extended properties could break compatibility with typed DataSets v1, so, if we're not explicitly // requested to do so, we generate only the ones used for naming (added by us) SortedList namingProperties = new SortedList(new Comparer(System.Globalization.CultureInfo.InvariantCulture)); foreach(string extPropName in targetObject.NamingPropertyNames) { string extPropValue = extendedProperties[extPropName] as string; if(!StringUtil.Empty(extPropValue)) { namingProperties.Add((string)extPropName, extPropValue); } } GenerateProperties(addTarget, statementCollection, namingProperties); } } private static void GenerateProperties(CodeExpression addTarget, IList statementCollection, ICollection extendedProperties) { if (extendedProperties != null) { IDictionaryEnumerator enumerator = (IDictionaryEnumerator) extendedProperties.GetEnumerator(); if (enumerator != null) { enumerator.Reset(); while (enumerator.MoveNext()) { string key = enumerator.Key as string; string val = enumerator.Value as string; if (key == null || val == null) { codeGenerator.ProblemList.Add( new DSGeneratorProblem(SR.GetString(SR.CG_UnableToReadExtProperties), ProblemSeverity.NonFatalError, targetObject) ); continue; } else { //\\.ExtendedProperties.Add( , ); statementCollection.Add( CodeGenHelper.Stm( CodeGenHelper.MethodCall( CodeGenHelper.Property( addTarget, "ExtendedProperties" ), "Add", new CodeExpression[] { CodeGenHelper.Primitive(key), CodeGenHelper.Primitive(val) } ) ) ); } } } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AgileSafeNativeMemoryHandle.cs
- CheckBoxList.cs
- SqlConnectionPoolProviderInfo.cs
- HostingEnvironmentSection.cs
- WizardStepBase.cs
- XsdCachingReader.cs
- DescendantBaseQuery.cs
- GeneralTransform3DGroup.cs
- TypedReference.cs
- DataBindingExpressionBuilder.cs
- ValidatorCompatibilityHelper.cs
- SchemaImporterExtension.cs
- ThousandthOfEmRealPoints.cs
- WebZone.cs
- BitmapFrameDecode.cs
- AssociationType.cs
- GridViewPageEventArgs.cs
- RegistryDataKey.cs
- X509CertificateRecipientClientCredential.cs
- ScriptResourceAttribute.cs
- DocobjHost.cs
- DataGridViewButtonColumn.cs
- SamlAudienceRestrictionCondition.cs
- XmlEntity.cs
- CodeExpressionStatement.cs
- MultiView.cs
- MailMessageEventArgs.cs
- ProfileSettingsCollection.cs
- SqlClientFactory.cs
- StylusDevice.cs
- ToolStripDesignerAvailabilityAttribute.cs
- WebPartCancelEventArgs.cs
- ToolboxItemImageConverter.cs
- BaseProcessor.cs
- ConvertEvent.cs
- XmlKeywords.cs
- JsonClassDataContract.cs
- RefType.cs
- RemoteWebConfigurationHostServer.cs
- ContextMenuStrip.cs
- ColorConverter.cs
- ResponseBodyWriter.cs
- BinaryConverter.cs
- IgnoreFileBuildProvider.cs
- SizeFConverter.cs
- EncoderFallback.cs
- TextFormatterContext.cs
- WmlPageAdapter.cs
- EmbeddedMailObjectsCollection.cs
- BitmapEffectInput.cs
- controlskin.cs
- Hex.cs
- SharedStatics.cs
- FixedSOMSemanticBox.cs
- SessionParameter.cs
- DetailsViewInsertedEventArgs.cs
- WindowsUpDown.cs
- MailFileEditor.cs
- IERequestCache.cs
- SyndicationCategory.cs
- XPathDocument.cs
- WmlListAdapter.cs
- SchemaElementLookUpTable.cs
- PackageFilter.cs
- XmlAttributeCache.cs
- WebProxyScriptElement.cs
- ObjectViewQueryResultData.cs
- GeometryModel3D.cs
- ProtocolsConfigurationHandler.cs
- httpstaticobjectscollection.cs
- ClrPerspective.cs
- BitmapDownload.cs
- List.cs
- WindowManager.cs
- WorkflowControlEndpoint.cs
- HtmlTableCellCollection.cs
- Rotation3D.cs
- xmlsaver.cs
- PathSegmentCollection.cs
- DataStreamFromComStream.cs
- RedirectionProxy.cs
- AuthenticationService.cs
- LiteralTextContainerControlBuilder.cs
- ellipse.cs
- StubHelpers.cs
- COM2EnumConverter.cs
- CaseInsensitiveComparer.cs
- GeneralTransform3DCollection.cs
- AutomationPatternInfo.cs
- QueryableDataSourceEditData.cs
- Repeater.cs
- SqlRowUpdatedEvent.cs
- DataGridViewColumn.cs
- ClientRuntimeConfig.cs
- FontFamilyConverter.cs
- QueryInterceptorAttribute.cs
- TagMapInfo.cs
- PropertyNames.cs
- SQLGuidStorage.cs
- ActivityDesignerLayoutSerializers.cs