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
- ConstNode.cs
- FileVersion.cs
- ManipulationInertiaStartingEventArgs.cs
- SelectedDatesCollection.cs
- CommandEventArgs.cs
- RegistryExceptionHelper.cs
- DataSourceCache.cs
- PropertyItem.cs
- StyleTypedPropertyAttribute.cs
- RegexRunnerFactory.cs
- Application.cs
- ChannelTerminatedException.cs
- ObjectDataSourceDisposingEventArgs.cs
- Utility.cs
- SerializerProvider.cs
- TextBoxRenderer.cs
- SerializationHelper.cs
- DoubleAnimation.cs
- ResXBuildProvider.cs
- WrapPanel.cs
- RowParagraph.cs
- XmlDataFileEditor.cs
- ImageConverter.cs
- FixedSOMTableCell.cs
- WindowsFont.cs
- QuinticEase.cs
- MapPathBasedVirtualPathProvider.cs
- ResourceBinder.cs
- LocatorManager.cs
- infer.cs
- SystemIPInterfaceStatistics.cs
- AuthorizationSection.cs
- Hash.cs
- HierarchicalDataBoundControlAdapter.cs
- ConfigXmlCDataSection.cs
- FrameAutomationPeer.cs
- TransformationRules.cs
- Geometry.cs
- AssemblyCache.cs
- nulltextnavigator.cs
- EmptyEnumerator.cs
- NodeLabelEditEvent.cs
- Visual3DCollection.cs
- DataServiceRequestArgs.cs
- SafePEFileHandle.cs
- TypeUsageBuilder.cs
- MetabaseServerConfig.cs
- ObjectViewQueryResultData.cs
- UniqueIdentifierService.cs
- Sequence.cs
- listviewsubitemcollectioneditor.cs
- Animatable.cs
- SystemGatewayIPAddressInformation.cs
- InplaceBitmapMetadataWriter.cs
- StorageMappingFragment.cs
- DiscoveryReferences.cs
- TextSpanModifier.cs
- ProxyWebPartManager.cs
- ProxyWebPartConnectionCollection.cs
- HttpProcessUtility.cs
- InputLanguageManager.cs
- DataService.cs
- Documentation.cs
- MethodBody.cs
- FontStyles.cs
- CodeParameterDeclarationExpression.cs
- FormsAuthenticationTicket.cs
- EditingScopeUndoUnit.cs
- TypeBuilder.cs
- TextBlock.cs
- ErrorInfoXmlDocument.cs
- FilterableAttribute.cs
- SkipQueryOptionExpression.cs
- File.cs
- SecurityResources.cs
- TextBoxView.cs
- XmlChoiceIdentifierAttribute.cs
- StickyNoteContentControl.cs
- QualifiedCellIdBoolean.cs
- DbConnectionFactory.cs
- TextEffect.cs
- DecimalAnimation.cs
- CqlParserHelpers.cs
- MiniAssembly.cs
- SafeViewOfFileHandle.cs
- SafeLocalMemHandle.cs
- WhitespaceRule.cs
- PathFigureCollectionConverter.cs
- GacUtil.cs
- sqlnorm.cs
- ClientSettingsStore.cs
- PrivilegeNotHeldException.cs
- RenderOptions.cs
- BamlRecordReader.cs
- SemanticResultKey.cs
- InternalBase.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- ConfigPathUtility.cs
- WindowsFormsHostPropertyMap.cs
- HttpWebRequest.cs