Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWebControlsDesign / System / Data / WebControls / Design / EntityDataSourceContainerNameConverter.cs / 3 / EntityDataSourceContainerNameConverter.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 EntityDataSourceContainerNameConverter : StringConverter
{
public EntityDataSourceContainerNameConverter()
: base()
{
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
// We can only get a list of possible DefaultContainerName values if we have:
// (1) Connection string so we can load metadata
// Even if this value is set, it may not be possible to actually load the metadata, but at least we can try the lookup if requested
EntityDataSource entityDataSource = context.Instance as EntityDataSource;
if (entityDataSource != null && !String.IsNullOrEmpty(entityDataSource.ConnectionString))
{
List containerNameItems = new EntityDataSourceDesignerHelper(entityDataSource, false /*interactiveMode*/).GetContainerNames(true /*sortResults*/);
string[] containers = new string[containerNameItems.Count];
for (int i = 0; i < containerNameItems.Count; i++)
{
containers[i] = containerNameItems[i].ToString();
}
return new StandardValuesCollection(containers);
}
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 EntityDataSourceContainerNameConverter : StringConverter
{
public EntityDataSourceContainerNameConverter()
: base()
{
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
// We can only get a list of possible DefaultContainerName values if we have:
// (1) Connection string so we can load metadata
// Even if this value is set, it may not be possible to actually load the metadata, but at least we can try the lookup if requested
EntityDataSource entityDataSource = context.Instance as EntityDataSource;
if (entityDataSource != null && !String.IsNullOrEmpty(entityDataSource.ConnectionString))
{
List containerNameItems = new EntityDataSourceDesignerHelper(entityDataSource, false /*interactiveMode*/).GetContainerNames(true /*sortResults*/);
string[] containers = new string[containerNameItems.Count];
for (int i = 0; i < containerNameItems.Count; i++)
{
containers[i] = containerNameItems[i].ToString();
}
return new StandardValuesCollection(containers);
}
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
- CheckBoxStandardAdapter.cs
- DynamicPropertyReader.cs
- InkSerializer.cs
- SetState.cs
- SrgsToken.cs
- XhtmlStyleClass.cs
- XsltContext.cs
- XmlNamespaceDeclarationsAttribute.cs
- VirtualizingPanel.cs
- DefaultExpression.cs
- MailAddress.cs
- EnumerableValidator.cs
- ListViewItemSelectionChangedEvent.cs
- XmlAttributeCache.cs
- CompilerInfo.cs
- DataReaderContainer.cs
- RecordManager.cs
- ControlUtil.cs
- CollectionViewSource.cs
- Context.cs
- FixedDocumentPaginator.cs
- PropertyNames.cs
- StrokeCollection.cs
- TreeNodeCollectionEditorDialog.cs
- ObjectCloneHelper.cs
- Internal.cs
- SecurityPermission.cs
- ClientScriptManager.cs
- MultipartContentParser.cs
- WorkflowQueuingService.cs
- BrowserTree.cs
- KeyManager.cs
- RunClient.cs
- ToolConsole.cs
- RijndaelManagedTransform.cs
- EntityContainerRelationshipSet.cs
- StrokeRenderer.cs
- DrawingContextWalker.cs
- UiaCoreApi.cs
- PermissionSet.cs
- VectorAnimationUsingKeyFrames.cs
- PageParser.cs
- XmlJsonReader.cs
- MessageDecoder.cs
- OpenTypeCommon.cs
- X509Certificate2Collection.cs
- HtmlInputSubmit.cs
- StylusTip.cs
- Decorator.cs
- SqlRewriteScalarSubqueries.cs
- BaseDataBoundControlDesigner.cs
- LingerOption.cs
- EventSourceCreationData.cs
- Convert.cs
- Light.cs
- TemplateBindingExtensionConverter.cs
- figurelength.cs
- AssemblyLoader.cs
- DeviceSpecific.cs
- AsymmetricAlgorithm.cs
- DesignConnectionCollection.cs
- ByteRangeDownloader.cs
- Stackframe.cs
- XmlSchemaDatatype.cs
- ActivationArguments.cs
- DataViewListener.cs
- DesignerFrame.cs
- tooltip.cs
- Expander.cs
- QilLiteral.cs
- IISMapPath.cs
- TrackingProfile.cs
- MetadataWorkspace.cs
- IteratorFilter.cs
- InstanceOwnerException.cs
- FixedTextView.cs
- DataBindingCollection.cs
- KnownTypes.cs
- AutoResetEvent.cs
- SafeCryptHandles.cs
- PagedDataSource.cs
- Renderer.cs
- ContentDisposition.cs
- MSAAWinEventWrap.cs
- UserControl.cs
- ObservableDictionary.cs
- TerminatorSinks.cs
- ProjectionPath.cs
- UnmanagedMemoryStream.cs
- SafeHandles.cs
- DesignerSerializationVisibilityAttribute.cs
- SoapExtensionReflector.cs
- IpcClientManager.cs
- XPathAncestorQuery.cs
- SecureUICommand.cs
- ProcessExitedException.cs
- DataGridViewRowCancelEventArgs.cs
- DiffuseMaterial.cs
- SignatureResourcePool.cs
- AsymmetricSignatureDeformatter.cs