Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / SchemaElementLookUpTable.cs / 1305376 / SchemaElementLookUpTable.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Data; using System.Data.Metadata.Edm; namespace System.Data.EntityModel.SchemaObjectModel { ////// Summary description for SchemaElementLookUpTable. /// internal sealed class SchemaElementLookUpTable: IEnumerable , ISchemaElementLookUpTable where T : SchemaElement { #region Instance Fields private Dictionary _keyToType = null; private List _keysInDefOrder = new List (); #endregion #region Public Methods /// /// /// public SchemaElementLookUpTable() { } ////// /// public int Count { get { return KeyToType.Count; } } ////// /// /// ///public bool ContainsKey(string key) { return KeyToType.ContainsKey(KeyFromName(key)); } /// /// /// /// ///public T LookUpEquivalentKey(string key) { key = KeyFromName(key); T element; if (KeyToType.TryGetValue(key, out element)) { return element; } return null; } /// /// /// public T this[string key] { get { return KeyToType[KeyFromName(key)]; } } ////// /// public T GetElementAt(int index) { return KeyToType[_keysInDefOrder[index]]; } ////// /// ///public IEnumerator GetEnumerator() { return new SchemaElementLookUpTableEnumerator (KeyToType,_keysInDefOrder); } IEnumerator System.Collections.IEnumerable.GetEnumerator() { return new SchemaElementLookUpTableEnumerator (KeyToType,_keysInDefOrder); } /// /// /// ///public IEnumerator GetFilteredEnumerator() where S : T { return new SchemaElementLookUpTableEnumerator(KeyToType,_keysInDefOrder); } ////// Add the given type to the schema look up table. If there is an error, it /// adds the error and returns false. otherwise, it adds the type to the lookuptable /// and returns true /// public AddErrorKind TryAdd(T type) { Debug.Assert(type != null, "type parameter is null"); if (String.IsNullOrEmpty(type.Identity)) { return AddErrorKind.MissingNameError; } string key = KeyFromElement(type); T element; if (KeyToType.TryGetValue(key, out element)) { return AddErrorKind.DuplicateNameError; } KeyToType.Add(key,type); _keysInDefOrder.Add(key); return AddErrorKind.Succeeded; } public void Add(T type, bool doNotAddErrorForEmptyName, Func
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Facet.cs
- AsymmetricKeyExchangeFormatter.cs
- WebPartConnectionsCancelEventArgs.cs
- ProcessHostMapPath.cs
- XdrBuilder.cs
- _NtlmClient.cs
- WebPartConnectionsDisconnectVerb.cs
- SourceLocationProvider.cs
- StateMachineHelpers.cs
- RSAProtectedConfigurationProvider.cs
- BufferModesCollection.cs
- DefaultProxySection.cs
- AspNetHostingPermission.cs
- EnumBuilder.cs
- GroupBoxRenderer.cs
- FileDataSourceCache.cs
- XmlSchemaParticle.cs
- ApplyTemplatesAction.cs
- WebServiceReceiveDesigner.cs
- DataGridViewSelectedColumnCollection.cs
- SevenBitStream.cs
- RTLAwareMessageBox.cs
- PackageProperties.cs
- AnnotationComponentManager.cs
- VisualStyleRenderer.cs
- DelayedRegex.cs
- TextSpanModifier.cs
- SchemaNamespaceManager.cs
- Mappings.cs
- OdbcConnectionOpen.cs
- _SslStream.cs
- StringInfo.cs
- ComNativeDescriptor.cs
- LeaseManager.cs
- MarkedHighlightComponent.cs
- SignedXml.cs
- OdbcTransaction.cs
- XmlJsonWriter.cs
- ConfigUtil.cs
- ToolStripItemImageRenderEventArgs.cs
- FilteredReadOnlyMetadataCollection.cs
- Ipv6Element.cs
- Int64Converter.cs
- Select.cs
- _HeaderInfoTable.cs
- Calendar.cs
- XmlSchemaNotation.cs
- SmiXetterAccessMap.cs
- EFColumnProvider.cs
- ButtonPopupAdapter.cs
- SrgsGrammarCompiler.cs
- SqlCaseSimplifier.cs
- TextEndOfParagraph.cs
- TextPointerBase.cs
- CompModSwitches.cs
- DrawListViewSubItemEventArgs.cs
- SafeRegistryHandle.cs
- Transform3D.cs
- AppLevelCompilationSectionCache.cs
- SoapHttpTransportImporter.cs
- RepeatBehaviorConverter.cs
- ElementHost.cs
- UpdatePanelTrigger.cs
- RelationshipEndCollection.cs
- _ChunkParse.cs
- ReadOnlyCollection.cs
- DateTimeConstantAttribute.cs
- JsonServiceDocumentSerializer.cs
- SafeThreadHandle.cs
- DesignerActionUIService.cs
- TextTreeInsertUndoUnit.cs
- RoutingExtension.cs
- Literal.cs
- PasswordBoxAutomationPeer.cs
- GridViewRowCollection.cs
- DialogBaseForm.cs
- CombinedGeometry.cs
- SimpleBitVector32.cs
- SettingsProviderCollection.cs
- TableStyle.cs
- TrayIconDesigner.cs
- MenuItemBinding.cs
- BlurBitmapEffect.cs
- SerialStream.cs
- RawContentTypeMapper.cs
- SQLBinaryStorage.cs
- ImpersonationOption.cs
- TraceXPathNavigator.cs
- counter.cs
- MissingMethodException.cs
- AutomationEvent.cs
- CommandLineParser.cs
- Update.cs
- ComplexPropertyEntry.cs
- UInt64Storage.cs
- BitmapMetadataBlob.cs
- GenericRootAutomationPeer.cs
- DependencyPropertyValueSerializer.cs
- DetailsView.cs
- AsyncResult.cs