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))
{
List entitySetNameItems = 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))
{
List entitySetNameItems = 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
- TransportConfigurationTypeElementCollection.cs
- MemoryRecordBuffer.cs
- Normalization.cs
- ConsoleTraceListener.cs
- WindowsFormsDesignerOptionService.cs
- StateManagedCollection.cs
- AssemblyLoader.cs
- ConfigurationElementProperty.cs
- CustomAssemblyResolver.cs
- Drawing.cs
- TypedTableBaseExtensions.cs
- TabControlDesigner.cs
- ImportOptions.cs
- XsdDuration.cs
- TemplateBaseAction.cs
- TrackingLocationCollection.cs
- ManualResetEventSlim.cs
- SecurityKeyEntropyMode.cs
- PositiveTimeSpanValidatorAttribute.cs
- _CookieModule.cs
- TableLayoutSettingsTypeConverter.cs
- UnknownBitmapDecoder.cs
- ReaderWriterLockWrapper.cs
- ClassHandlersStore.cs
- MainMenu.cs
- XmlTextEncoder.cs
- ResourceSet.cs
- WinFormsSecurity.cs
- CheckBoxPopupAdapter.cs
- ConfigXmlSignificantWhitespace.cs
- SystemColors.cs
- HttpProtocolReflector.cs
- IDQuery.cs
- TableLayout.cs
- Collection.cs
- ServicePointManagerElement.cs
- ToolStripLabel.cs
- SemanticResultValue.cs
- DbParameterHelper.cs
- XPathSelfQuery.cs
- ActivityBindForm.cs
- PrimitiveXmlSerializers.cs
- PropertyDescriptorComparer.cs
- FontDriver.cs
- DependencyPropertyConverter.cs
- Oid.cs
- NamespaceEmitter.cs
- CertificateManager.cs
- DesignerOptionService.cs
- CmsInterop.cs
- AtomServiceDocumentSerializer.cs
- UrlMappingsSection.cs
- ContextDataSourceContextData.cs
- ConnectionPointGlyph.cs
- SqlCacheDependencyDatabaseCollection.cs
- BackgroundFormatInfo.cs
- WsdlBuildProvider.cs
- JsonDataContract.cs
- InputGestureCollection.cs
- RSAPKCS1KeyExchangeFormatter.cs
- LinkLabelLinkClickedEvent.cs
- AbstractExpressions.cs
- ComponentDispatcher.cs
- AnnotationResourceCollection.cs
- XmlSchemaCompilationSettings.cs
- HostProtectionPermission.cs
- MethodCallConverter.cs
- SponsorHelper.cs
- SvcFileManager.cs
- AssociatedControlConverter.cs
- AddInSegmentDirectoryNotFoundException.cs
- TextTreeFixupNode.cs
- PageBuildProvider.cs
- ListViewInsertionMark.cs
- VisualBrush.cs
- TextParaClient.cs
- MultipartContentParser.cs
- XamlHostingSectionGroup.cs
- DoubleLinkList.cs
- MaxSessionCountExceededException.cs
- RegistryDataKey.cs
- LinkUtilities.cs
- UnsafeNativeMethodsPenimc.cs
- SqlBulkCopy.cs
- HwndProxyElementProvider.cs
- PackagingUtilities.cs
- ToolStripItemClickedEventArgs.cs
- LookupNode.cs
- XmlRawWriter.cs
- AQNBuilder.cs
- UncommonField.cs
- IChannel.cs
- UInt64Converter.cs
- TypedServiceChannelBuilder.cs
- DateTimeOffsetAdapter.cs
- XmlWriter.cs
- CodeDirectoryCompiler.cs
- CacheChildrenQuery.cs
- ComponentResourceKey.cs
- HtmlElementErrorEventArgs.cs