Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWebControlsDesign / System / Data / WebControls / Design / EntityDataSourceEntityTypeFilterConverter.cs / 1305376 / EntityDataSourceEntityTypeFilterConverter.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 EntityDataSourceEntityTypeFilterConverter : StringConverter
{
public EntityDataSourceEntityTypeFilterConverter()
: base()
{
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
// We can only get a list of possible EntityTypeFilter values if we have:
// (1) Connection string so we can load metadata
// (2) DefaultContainerName to give scope to the lookup
// (3) EntitySetName that exists in DefaultContainerName so we can get its type and derived types
// 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) &&
!String.IsNullOrEmpty(entityDataSource.EntitySetName))
{
List entityTypeFilterItems =
new EntityDataSourceDesignerHelper(entityDataSource, false /*interactiveMode*/).GetEntityTypeFilters(
entityDataSource.DefaultContainerName, entityDataSource.EntitySetName);
string[] entityTypeFilters = new string[entityTypeFilterItems.Count];
for (int i = 0; i < entityTypeFilterItems.Count; i++)
{
entityTypeFilters[i] = entityTypeFilterItems[i].EntityTypeName;
}
return new StandardValuesCollection(entityTypeFilters);
}
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
- TemplatedAdorner.cs
- EventRoute.cs
- MD5.cs
- XmlHelper.cs
- SoapHelper.cs
- CatalogPart.cs
- UrlAuthFailureHandler.cs
- ProfileServiceManager.cs
- FileStream.cs
- PathNode.cs
- WizardStepBase.cs
- RuleDefinitions.cs
- SamlAuthorizationDecisionStatement.cs
- CultureInfoConverter.cs
- StructuredType.cs
- PopupRootAutomationPeer.cs
- CompiledQueryCacheEntry.cs
- ClassicBorderDecorator.cs
- SmiContext.cs
- InputLanguageCollection.cs
- ViewCellSlot.cs
- GridEntry.cs
- Soap.cs
- AttributeEmitter.cs
- StateRuntime.cs
- ImageDrawing.cs
- SourceChangedEventArgs.cs
- ListBindableAttribute.cs
- FormattedText.cs
- SimpleWorkerRequest.cs
- BufferBuilder.cs
- OleDbInfoMessageEvent.cs
- Vector3DCollection.cs
- Condition.cs
- NoneExcludedImageIndexConverter.cs
- OracleFactory.cs
- ConfigXmlElement.cs
- SiteMapNodeItemEventArgs.cs
- ScriptControlManager.cs
- DataGrid.cs
- SqlStatistics.cs
- XamlTemplateSerializer.cs
- DbSetClause.cs
- UnorderedHashRepartitionStream.cs
- ImageAttributes.cs
- SEHException.cs
- RemotingAttributes.cs
- FontStretch.cs
- Exception.cs
- DirectionalLight.cs
- StructuredProperty.cs
- RenderData.cs
- AQNBuilder.cs
- StrokeFIndices.cs
- CheckedListBox.cs
- DataGridColumnHeaderCollection.cs
- XmlUrlResolver.cs
- SerializableAttribute.cs
- EmptyEnumerable.cs
- TargetException.cs
- InstanceDataCollectionCollection.cs
- Pen.cs
- ExpressionBuilderCollection.cs
- ThreadStateException.cs
- NumericPagerField.cs
- ToolStripSystemRenderer.cs
- StoreItemCollection.Loader.cs
- ISAPIWorkerRequest.cs
- AssociationSet.cs
- TextProperties.cs
- BaseConfigurationRecord.cs
- ModifierKeysValueSerializer.cs
- SearchForVirtualItemEventArgs.cs
- UnSafeCharBuffer.cs
- AbandonedMutexException.cs
- TypeUtil.cs
- NativeMethods.cs
- XsdValidatingReader.cs
- ColumnMap.cs
- BitVector32.cs
- DelegateSerializationHolder.cs
- Underline.cs
- EmbeddedMailObject.cs
- RepeatButtonAutomationPeer.cs
- TypeResolver.cs
- MultiTrigger.cs
- ByteKeyFrameCollection.cs
- DefaultBindingPropertyAttribute.cs
- MailBnfHelper.cs
- PrePrepareMethodAttribute.cs
- hresults.cs
- SynchronizationLockException.cs
- TraceHelpers.cs
- TraceXPathNavigator.cs
- SamlAuthenticationStatement.cs
- ListViewInsertEventArgs.cs
- XmlSchemaImport.cs
- FacetChecker.cs
- DeferredRunTextReference.cs
- SqlStream.cs