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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScriptServiceAttribute.cs
- LinkUtilities.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- PrimitiveType.cs
- Message.cs
- TextElementEnumerator.cs
- IndentedWriter.cs
- IISMapPath.cs
- CapabilitiesAssignment.cs
- Compiler.cs
- KeyProperty.cs
- PagesSection.cs
- SiteMapDataSourceView.cs
- SerialReceived.cs
- XmlComplianceUtil.cs
- GraphicsState.cs
- BitmapSource.cs
- UniqueContractNameValidationBehavior.cs
- ComponentResourceKeyConverter.cs
- OneWayChannelListener.cs
- XsdDuration.cs
- CompositeKey.cs
- ConfigsHelper.cs
- DetailsViewDeleteEventArgs.cs
- X509PeerCertificateAuthenticationElement.cs
- ProcessHost.cs
- HttpPostLocalhostServerProtocol.cs
- Descriptor.cs
- SoapExtensionTypeElement.cs
- AutomationFocusChangedEventArgs.cs
- CodeTryCatchFinallyStatement.cs
- RecordManager.cs
- ListViewPagedDataSource.cs
- EncoderExceptionFallback.cs
- Function.cs
- SoapServerMessage.cs
- SQLInt16Storage.cs
- MapPathBasedVirtualPathProvider.cs
- FrameAutomationPeer.cs
- GrammarBuilderDictation.cs
- ISFClipboardData.cs
- Keywords.cs
- MetadataArtifactLoader.cs
- DeferredTextReference.cs
- Trustee.cs
- ContextDataSourceContextData.cs
- XmlIlTypeHelper.cs
- MouseGestureConverter.cs
- TypeResolver.cs
- HostExecutionContextManager.cs
- FontWeight.cs
- Thickness.cs
- Interlocked.cs
- XMLDiffLoader.cs
- Brush.cs
- InternalDuplexChannelFactory.cs
- ProfilePropertyMetadata.cs
- MeshGeometry3D.cs
- UInt64Converter.cs
- CellParagraph.cs
- ClientTargetSection.cs
- _WinHttpWebProxyDataBuilder.cs
- ServiceDescriptionData.cs
- TextTabProperties.cs
- ComponentResourceKeyConverter.cs
- SourceLineInfo.cs
- BindingMemberInfo.cs
- XmlDeclaration.cs
- SqlCacheDependencySection.cs
- HttpResponseInternalBase.cs
- SafeNativeMethodsOther.cs
- ClassHandlersStore.cs
- Model3DCollection.cs
- DragCompletedEventArgs.cs
- DecimalKeyFrameCollection.cs
- PagerSettings.cs
- TableRowCollection.cs
- SiteMapNode.cs
- InternalBufferManager.cs
- X509UI.cs
- ActiveXContainer.cs
- IPGlobalProperties.cs
- LeaseManager.cs
- HeaderedContentControl.cs
- SID.cs
- Signature.cs
- HttpListenerRequestTraceRecord.cs
- TextServicesDisplayAttributePropertyRanges.cs
- Selection.cs
- SettingsProperty.cs
- XsdBuilder.cs
- DesignerActionItemCollection.cs
- RowSpanVector.cs
- DecoderBestFitFallback.cs
- ModelTreeEnumerator.cs
- Variant.cs
- NestedContainer.cs
- CompoundFileIOPermission.cs
- WebScriptMetadataInstanceContextProvider.cs
- basemetadatamappingvisitor.cs