Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / SchemaElementLookUpTable.cs / 2 / 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
- ActiveXContainer.cs
- FixedPosition.cs
- EntitySet.cs
- XmlDigitalSignatureProcessor.cs
- webproxy.cs
- XmlNodeChangedEventManager.cs
- WebConfigurationFileMap.cs
- EnumCodeDomSerializer.cs
- Behavior.cs
- ServicePointManager.cs
- DataGridViewRowPrePaintEventArgs.cs
- LabelEditEvent.cs
- LineProperties.cs
- SqlDataReaderSmi.cs
- InstanceNormalEvent.cs
- EntitySqlException.cs
- DataGridViewRowsRemovedEventArgs.cs
- DataGridViewCheckBoxColumn.cs
- SessionPageStateSection.cs
- SourceFileBuildProvider.cs
- HeaderedContentControl.cs
- CommandEventArgs.cs
- TextContainer.cs
- DesignBindingPicker.cs
- PenContexts.cs
- StorageComplexTypeMapping.cs
- DragDropManager.cs
- SelectorAutomationPeer.cs
- Hex.cs
- TemplatePagerField.cs
- HeaderUtility.cs
- JsonReaderWriterFactory.cs
- LightweightEntityWrapper.cs
- GPRECT.cs
- TogglePattern.cs
- EventDescriptor.cs
- CodeTypeConstructor.cs
- BidPrivateBase.cs
- PageContentCollection.cs
- BulletChrome.cs
- AutomationPropertyInfo.cs
- UrlMappingCollection.cs
- ExecutionEngineException.cs
- InputQueue.cs
- TdsParserSafeHandles.cs
- ShaderEffect.cs
- OLEDB_Util.cs
- DynamicMetaObjectBinder.cs
- IndentTextWriter.cs
- SqlMethodAttribute.cs
- GlyphRun.cs
- WindowsListViewGroup.cs
- ClusterUtils.cs
- HotSpot.cs
- Tuple.cs
- CfgParser.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- MethodRental.cs
- SettingsSection.cs
- TrackingParameters.cs
- ItemCheckedEvent.cs
- WebUtil.cs
- Attribute.cs
- SecureEnvironment.cs
- DataGridViewCellFormattingEventArgs.cs
- DataObjectEventArgs.cs
- FrameSecurityDescriptor.cs
- TreeNodeSelectionProcessor.cs
- HwndKeyboardInputProvider.cs
- UnsafeNativeMethods.cs
- AutomationProperty.cs
- BinaryReader.cs
- ConditionedDesigner.cs
- CodePropertyReferenceExpression.cs
- RoutedEventArgs.cs
- CheckPair.cs
- ToolStripRenderEventArgs.cs
- Size3DValueSerializer.cs
- HistoryEventArgs.cs
- ProtocolsConfigurationEntry.cs
- _NtlmClient.cs
- FtpWebRequest.cs
- ContentDisposition.cs
- XPathArrayIterator.cs
- WebAdminConfigurationHelper.cs
- TransformPattern.cs
- Block.cs
- WebPartTransformerCollection.cs
- HttpMethodAttribute.cs
- TextServicesContext.cs
- ColorMap.cs
- EpmSyndicationContentDeSerializer.cs
- DynamicControlParameter.cs
- XsltArgumentList.cs
- AddingNewEventArgs.cs
- EntityCommandExecutionException.cs
- TextMessageEncodingElement.cs
- DescriptionAttribute.cs
- ObjectReferenceStack.cs
- DataGridRowEventArgs.cs