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
- BuildManagerHost.cs
- CultureTableRecord.cs
- XmlSchemaAttributeGroupRef.cs
- ScriptComponentDescriptor.cs
- DateTimeUtil.cs
- SqlDataReader.cs
- SafeLibraryHandle.cs
- HMACSHA384.cs
- ProviderException.cs
- LinearKeyFrames.cs
- AccessText.cs
- EventDescriptor.cs
- ExternalException.cs
- PocoPropertyAccessorStrategy.cs
- XPathSingletonIterator.cs
- AjaxFrameworkAssemblyAttribute.cs
- Typeface.cs
- RequestCachingSection.cs
- SmiMetaDataProperty.cs
- SqlUserDefinedAggregateAttribute.cs
- IChannel.cs
- TreeNode.cs
- SafeHandle.cs
- ToolStripButton.cs
- DecodeHelper.cs
- UseLicense.cs
- SchemaCollectionPreprocessor.cs
- SystemWebSectionGroup.cs
- Resources.Designer.cs
- ObjectContext.cs
- DataSourceProvider.cs
- SocketSettings.cs
- ActionFrame.cs
- IconHelper.cs
- SiteMapProvider.cs
- BoundsDrawingContextWalker.cs
- ContentHostHelper.cs
- Menu.cs
- CustomServiceCredentials.cs
- HttpAsyncResult.cs
- Add.cs
- dbdatarecord.cs
- Pair.cs
- Opcode.cs
- ToolStripLocationCancelEventArgs.cs
- GetPageNumberCompletedEventArgs.cs
- UIElementParagraph.cs
- WebConfigurationManager.cs
- DiscoveryReference.cs
- LayoutManager.cs
- HitTestResult.cs
- HighlightVisual.cs
- XslException.cs
- WebBrowsableAttribute.cs
- AccessDataSourceView.cs
- DragCompletedEventArgs.cs
- ColorBlend.cs
- TrustManagerPromptUI.cs
- CrossContextChannel.cs
- XmlDocumentSerializer.cs
- ListViewEditEventArgs.cs
- HtmlTableRow.cs
- WorkflowQueue.cs
- TransactionsSectionGroup.cs
- PermissionListSet.cs
- PagedDataSource.cs
- CopyAction.cs
- DBConnection.cs
- ZipIOFileItemStream.cs
- ProxyFragment.cs
- ComAdminWrapper.cs
- BitmapEffectGeneralTransform.cs
- TextDecorationUnitValidation.cs
- ProcessModule.cs
- ModelPerspective.cs
- SqlCaseSimplifier.cs
- NamedPipeChannelFactory.cs
- DataKeyCollection.cs
- CodeTypeMember.cs
- WebResourceUtil.cs
- XmlSchemaComplexContent.cs
- CodeArgumentReferenceExpression.cs
- XmlUrlResolver.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ListBox.cs
- DateRangeEvent.cs
- SmtpSection.cs
- HttpAsyncResult.cs
- ZipIOModeEnforcingStream.cs
- RemoteWebConfigurationHostServer.cs
- ValidatorCollection.cs
- validationstate.cs
- SafeBitVector32.cs
- RangeValuePattern.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- AdornerHitTestResult.cs
- DecimalAnimationUsingKeyFrames.cs
- DuplexChannelBinder.cs
- GlyphTypeface.cs
- CipherData.cs