Code:
/ 4.0 / 4.0 / untmp / 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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ChannelSinkStacks.cs
- DataGridViewCellStyleEditor.cs
- DataListItemEventArgs.cs
- FileDialog.cs
- FullTrustAssemblyCollection.cs
- PolicyVersion.cs
- ModifierKeysConverter.cs
- AsnEncodedData.cs
- FirstQueryOperator.cs
- SecurityIdentifierConverter.cs
- MessageFormatterConverter.cs
- PnrpPermission.cs
- SettingsProviderCollection.cs
- PopupControlService.cs
- HttpRequestCacheValidator.cs
- WebPartMenuStyle.cs
- ImageBrush.cs
- UnionCodeGroup.cs
- SubMenuStyleCollection.cs
- QuaternionKeyFrameCollection.cs
- altserialization.cs
- WebRequestModuleElementCollection.cs
- InputLanguageCollection.cs
- XsltException.cs
- TypePropertyEditor.cs
- StringFreezingAttribute.cs
- xmlfixedPageInfo.cs
- TextHidden.cs
- UserNameSecurityTokenAuthenticator.cs
- DataGridViewAccessibleObject.cs
- WebPartsPersonalizationAuthorization.cs
- WebPartUtil.cs
- PrimitiveList.cs
- SystemTcpStatistics.cs
- TrackBarDesigner.cs
- WindowHideOrCloseTracker.cs
- PreservationFileReader.cs
- SimpleType.cs
- PrivilegeNotHeldException.cs
- SqlCrossApplyToCrossJoin.cs
- ProcessModelInfo.cs
- ValueHandle.cs
- rsa.cs
- SessionChannels.cs
- ISAPIApplicationHost.cs
- DBSchemaTable.cs
- CopyNamespacesAction.cs
- ModelProperty.cs
- SQLBoolean.cs
- CodeValidator.cs
- RemoteWebConfigurationHostServer.cs
- TypeDefinition.cs
- ListViewGroupConverter.cs
- Rectangle.cs
- ContentFileHelper.cs
- SmiMetaDataProperty.cs
- PolicyStatement.cs
- InitialServerConnectionReader.cs
- GeneralTransformGroup.cs
- Socket.cs
- VisualBrush.cs
- PenThreadWorker.cs
- MultiSelector.cs
- DispatcherFrame.cs
- GradientSpreadMethodValidation.cs
- ListDataHelper.cs
- DispatchChannelSink.cs
- LinkClickEvent.cs
- StretchValidation.cs
- QilExpression.cs
- ClientData.cs
- WebPartUserCapability.cs
- UserPersonalizationStateInfo.cs
- DeploymentSectionCache.cs
- ColumnResult.cs
- MimeMapping.cs
- KnownBoxes.cs
- CompiledELinqQueryState.cs
- UInt32Converter.cs
- XmlTextAttribute.cs
- DirectoryObjectSecurity.cs
- OleDbEnumerator.cs
- EntitySqlQueryCacheEntry.cs
- ContainerUtilities.cs
- TextParaLineResult.cs
- ManifestResourceInfo.cs
- QueryProcessor.cs
- PocoEntityKeyStrategy.cs
- MasterPageCodeDomTreeGenerator.cs
- WebPartEventArgs.cs
- StyleBamlTreeBuilder.cs
- ListBindingHelper.cs
- ToolStripSystemRenderer.cs
- RectangleF.cs
- XmlSchemaAll.cs
- ListViewInsertEventArgs.cs
- EntityClassGenerator.cs
- EntityDataSourceView.cs
- EventProxy.cs
- HashStream.cs