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))
{
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
- WrapperEqualityComparer.cs
- SqlConnection.cs
- XmlQueryType.cs
- CounterCreationDataCollection.cs
- ScrollItemPattern.cs
- CommonGetThemePartSize.cs
- SocketInformation.cs
- SplitterCancelEvent.cs
- ToolStripDropDownButton.cs
- XmlSchemaSimpleContent.cs
- ClusterRegistryConfigurationProvider.cs
- SystemTcpStatistics.cs
- GetIndexBinder.cs
- RSAPKCS1KeyExchangeFormatter.cs
- OlePropertyStructs.cs
- DataBindingExpressionBuilder.cs
- Stopwatch.cs
- ReferenceAssemblyAttribute.cs
- TransportContext.cs
- SQLBinaryStorage.cs
- DbProviderFactories.cs
- NameValuePermission.cs
- EntitySetBase.cs
- StateBag.cs
- UIElement3D.cs
- TypedDataSetSchemaImporterExtension.cs
- SmtpNtlmAuthenticationModule.cs
- Pair.cs
- XmlILOptimizerVisitor.cs
- MsdtcClusterUtils.cs
- FloatUtil.cs
- TaskHelper.cs
- ObjectManager.cs
- Button.cs
- Message.cs
- RedBlackList.cs
- XmlSerializerFormatAttribute.cs
- XmlNodeChangedEventArgs.cs
- PathFigureCollectionConverter.cs
- TTSEvent.cs
- ScrollEventArgs.cs
- AsmxEndpointPickerExtension.cs
- XmlSequenceWriter.cs
- UrlAuthFailedErrorFormatter.cs
- SqlFactory.cs
- CorrelationManager.cs
- IImplicitResourceProvider.cs
- InvokeMethodActivityDesigner.cs
- DbDataRecord.cs
- TreeNode.cs
- DiagnosticsConfiguration.cs
- NavigationProperty.cs
- ResourceSet.cs
- SQLByte.cs
- AssociationTypeEmitter.cs
- RtfFormatStack.cs
- UserControlParser.cs
- InProcStateClientManager.cs
- SortKey.cs
- OdbcConnection.cs
- Helpers.cs
- BrushProxy.cs
- HostingPreferredMapPath.cs
- PackagingUtilities.cs
- State.cs
- FileSecurity.cs
- COM2IDispatchConverter.cs
- JsonReader.cs
- TimeStampChecker.cs
- ToolboxDataAttribute.cs
- SmiContext.cs
- WebEventTraceProvider.cs
- TextProviderWrapper.cs
- NetworkInformationException.cs
- IndicCharClassifier.cs
- baseaxisquery.cs
- PaintEvent.cs
- IconBitmapDecoder.cs
- BooleanStorage.cs
- WmlObjectListAdapter.cs
- EncodingFallbackAwareXmlTextWriter.cs
- TemplateKeyConverter.cs
- StringPropertyBuilder.cs
- WebPartActionVerb.cs
- Parameter.cs
- ButtonColumn.cs
- InputBinding.cs
- Content.cs
- QilSortKey.cs
- TemplatePropertyEntry.cs
- AssociationSetEnd.cs
- GlobalDataBindingHandler.cs
- ClassDataContract.cs
- AssemblyBuilderData.cs
- KnownTypes.cs
- PageAsyncTask.cs
- XpsInterleavingPolicy.cs
- ArraySegment.cs
- MachineKeySection.cs
- Rect.cs