Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWebControlsDesign / System / Data / WebControls / Design / entitydatasourceentitysetnameconverter.cs / 1305376 / entitydatasourceentitysetnameconverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //----------------------------------------------------------------------------- using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Web.UI.WebControls; namespace System.Web.UI.Design.WebControls { internal class EntityDataSourceEntitySetNameConverter : StringConverter { public EntityDataSourceEntitySetNameConverter() : base() { } public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { // We can only get a list of possible EntitySetName values if we have: // (1) Connection string so we can load metadata // (2) DefaultContainerName to give scope to the lookup // Even if these values are set, it may not be possible to actually find them in metadata, but at least we can try the lookup if requested EntityDataSource entityDataSource = context.Instance as EntityDataSource; if (entityDataSource != null && !String.IsNullOrEmpty(entityDataSource.ConnectionString) && !String.IsNullOrEmpty(entityDataSource.DefaultContainerName)) { ListentitySetNameItems = new EntityDataSourceDesignerHelper(entityDataSource, false /*interactiveMode*/).GetEntitySets(entityDataSource.DefaultContainerName); string[] entitySetNames = new string[entitySetNameItems.Count]; for (int i = 0; i < entitySetNameItems.Count; i++) { entitySetNames[i] = entitySetNameItems[i].EntitySetName; } return new StandardValuesCollection(entitySetNames); } return null; } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return false; } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //----------------------------------------------------------------------------- using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Web.UI.WebControls; namespace System.Web.UI.Design.WebControls { internal class EntityDataSourceEntitySetNameConverter : StringConverter { public EntityDataSourceEntitySetNameConverter() : base() { } public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { // We can only get a list of possible EntitySetName values if we have: // (1) Connection string so we can load metadata // (2) DefaultContainerName to give scope to the lookup // Even if these values are set, it may not be possible to actually find them in metadata, but at least we can try the lookup if requested EntityDataSource entityDataSource = context.Instance as EntityDataSource; if (entityDataSource != null && !String.IsNullOrEmpty(entityDataSource.ConnectionString) && !String.IsNullOrEmpty(entityDataSource.DefaultContainerName)) { ListentitySetNameItems = new EntityDataSourceDesignerHelper(entityDataSource, false /*interactiveMode*/).GetEntitySets(entityDataSource.DefaultContainerName); string[] entitySetNames = new string[entitySetNameItems.Count]; for (int i = 0; i < entitySetNameItems.Count; i++) { entitySetNames[i] = entitySetNameItems[i].EntitySetName; } return new StandardValuesCollection(entitySetNames); } return null; } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return false; } public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } } } // 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
- MemberInfoSerializationHolder.cs
- MatrixUtil.cs
- ToolStripActionList.cs
- CaseInsensitiveOrdinalStringComparer.cs
- EnglishPluralizationService.cs
- OracleMonthSpan.cs
- HyperLinkDesigner.cs
- Version.cs
- SynchronizedDispatch.cs
- BinHexEncoding.cs
- SelectionItemProviderWrapper.cs
- CompiledXpathExpr.cs
- ContentValidator.cs
- PrintingPermission.cs
- MasterPageBuildProvider.cs
- ButtonBase.cs
- CheckedListBox.cs
- ToolStripDropDownButton.cs
- validationstate.cs
- ParseHttpDate.cs
- PkcsMisc.cs
- UserNamePasswordValidator.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- PackageStore.cs
- TransformerInfo.cs
- AsyncStreamReader.cs
- WebBrowserDocumentCompletedEventHandler.cs
- RequestCache.cs
- Viewport3DVisual.cs
- UnsafeNativeMethods.cs
- SourceChangedEventArgs.cs
- TrackingServices.cs
- HttpProtocolImporter.cs
- Thread.cs
- OleDbSchemaGuid.cs
- AssociationSetMetadata.cs
- PolyQuadraticBezierSegment.cs
- PointAnimationBase.cs
- ExtendedProperty.cs
- NumberFormatter.cs
- assertwrapper.cs
- AutomationPeer.cs
- MessageBox.cs
- TextEffectCollection.cs
- OdbcException.cs
- ModelVisual3D.cs
- LifetimeMonitor.cs
- XmlDataProvider.cs
- Instrumentation.cs
- AsyncOperationContext.cs
- Thickness.cs
- ZipPackagePart.cs
- XmlArrayItemAttributes.cs
- DesignerGenericWebPart.cs
- HotCommands.cs
- LogSwitch.cs
- AccessText.cs
- DependencyPropertyDescriptor.cs
- Roles.cs
- RewritingProcessor.cs
- CustomTypeDescriptor.cs
- FolderBrowserDialog.cs
- TcpClientSocketManager.cs
- StylusPoint.cs
- Package.cs
- SqlBuffer.cs
- CollectionViewSource.cs
- CodeBlockBuilder.cs
- DataSourceCacheDurationConverter.cs
- XmlILStorageConverter.cs
- DelegatingHeader.cs
- XPathDocumentNavigator.cs
- FieldAccessException.cs
- WebPartDisplayModeCollection.cs
- ConvertTextFrag.cs
- UIElement3DAutomationPeer.cs
- AppSettingsReader.cs
- ConfigsHelper.cs
- XmlResolver.cs
- HttpServerVarsCollection.cs
- SqlTypesSchemaImporter.cs
- NameSpaceExtractor.cs
- XmlConvert.cs
- ToolStripPanelRow.cs
- Catch.cs
- FrugalMap.cs
- AppSettingsExpressionEditor.cs
- SafeEventLogReadHandle.cs
- UserControlBuildProvider.cs
- EncodingTable.cs
- SoapSchemaImporter.cs
- TargetControlTypeCache.cs
- VBCodeProvider.cs
- GeneralTransform.cs
- ProtectedProviderSettings.cs
- ConfigurationSection.cs
- DesignTimeTemplateParser.cs
- CoreChannel.cs
- CompilerScope.Storage.cs
- WebPartConnectionsConnectVerb.cs