Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWebControlsDesign / System / Data / WebControls / Design / entitydatasourceentitysetnameconverter.cs / 3 / 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
- DataViewManagerListItemTypeDescriptor.cs
- ArraySegment.cs
- DataGridCell.cs
- InputLangChangeRequestEvent.cs
- XmlSchemaComplexContentRestriction.cs
- CallContext.cs
- PointConverter.cs
- JsonDataContract.cs
- PropertyItem.cs
- CodeBinaryOperatorExpression.cs
- WindowsScroll.cs
- Section.cs
- SystemTcpConnection.cs
- RootAction.cs
- TextServicesHost.cs
- Assembly.cs
- XmlSubtreeReader.cs
- TimeoutException.cs
- StatusStrip.cs
- OleDbParameter.cs
- RegexRunner.cs
- BaseContextMenu.cs
- ScrollPattern.cs
- ImageCollectionCodeDomSerializer.cs
- RecoverInstanceLocksCommand.cs
- DetailsViewAutoFormat.cs
- ObservableDictionary.cs
- InvalidFilterCriteriaException.cs
- ButtonField.cs
- TextTreeExtractElementUndoUnit.cs
- AudienceUriMode.cs
- PaperSource.cs
- AnnotationComponentManager.cs
- Bitmap.cs
- HttpWriter.cs
- EFTableProvider.cs
- SmiEventStream.cs
- SQLGuid.cs
- XmlName.cs
- exports.cs
- Selector.cs
- ListBoxChrome.cs
- TypeSystem.cs
- ScriptingSectionGroup.cs
- SmiConnection.cs
- Int32RectValueSerializer.cs
- SqlBooleanizer.cs
- IProvider.cs
- ConfigurationSettings.cs
- LinqDataSourceContextEventArgs.cs
- BitmapEffectDrawing.cs
- StringSource.cs
- Accessible.cs
- WebHttpBindingCollectionElement.cs
- Int64Animation.cs
- GZipDecoder.cs
- TimeSpanConverter.cs
- RoutedEvent.cs
- remotingproxy.cs
- PenContext.cs
- AsyncOperationManager.cs
- Accessors.cs
- DesignerSerializerAttribute.cs
- DebugController.cs
- AddInBase.cs
- Debug.cs
- PageAsyncTaskManager.cs
- LinqDataSourceDisposeEventArgs.cs
- ConfigurationPermission.cs
- ColorAnimation.cs
- DiscoveryDocumentSearchPattern.cs
- NegotiationTokenAuthenticatorState.cs
- UIElement.cs
- HttpListenerRequestUriBuilder.cs
- XmlHierarchicalDataSourceView.cs
- TypedTableHandler.cs
- VirtualPathProvider.cs
- CustomAttributeSerializer.cs
- WindowsStatic.cs
- StringWriter.cs
- SqlBulkCopy.cs
- PrePrepareMethodAttribute.cs
- IOException.cs
- HandleCollector.cs
- BaseTreeIterator.cs
- InheritanceAttribute.cs
- DocumentViewerBase.cs
- RoleGroup.cs
- DrawingContextWalker.cs
- PersistChildrenAttribute.cs
- ToolStripRendererSwitcher.cs
- DataRecordInternal.cs
- CallbackDebugElement.cs
- brushes.cs
- TemplateField.cs
- XmlSchemaAttributeGroupRef.cs
- NumericUpDownAccelerationCollection.cs
- GroupBoxRenderer.cs
- SqlClientFactory.cs
- httpstaticobjectscollection.cs