Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- CreatingCookieEventArgs.cs
- StylusEditingBehavior.cs
- WebPartManager.cs
- Transform3D.cs
- ObjectDataSourceSelectingEventArgs.cs
- MdiWindowListItemConverter.cs
- UnknownMessageReceivedEventArgs.cs
- TypeDescriptorContext.cs
- PeerObject.cs
- RenderDataDrawingContext.cs
- WpfMemberInvoker.cs
- Paragraph.cs
- SystemDiagnosticsSection.cs
- SQLDateTime.cs
- LogLogRecordHeader.cs
- DateTimePickerDesigner.cs
- Char.cs
- XhtmlBasicSelectionListAdapter.cs
- OverrideMode.cs
- MenuTracker.cs
- MexBindingElement.cs
- TreeNode.cs
- JournalEntryListConverter.cs
- ScriptingSectionGroup.cs
- MetadataWorkspace.cs
- RectangleGeometry.cs
- DbFunctionCommandTree.cs
- UpdateTracker.cs
- ReadOnlyDataSourceView.cs
- AspNetSynchronizationContext.cs
- ObjectDataSourceView.cs
- SerializerWriterEventHandlers.cs
- SingleAnimationBase.cs
- ControlAdapter.cs
- ClearTypeHintValidation.cs
- TimeSpanHelper.cs
- PassportAuthentication.cs
- QueryCacheManager.cs
- ThemeableAttribute.cs
- ConfigurationStrings.cs
- WebEventCodes.cs
- EventRouteFactory.cs
- HttpWebRequest.cs
- MessageQueuePermissionEntryCollection.cs
- StateMachineExecutionState.cs
- BamlRecordWriter.cs
- SubMenuStyleCollectionEditor.cs
- IChannel.cs
- Style.cs
- DataGridTablesFactory.cs
- SqlCachedBuffer.cs
- PbrsForward.cs
- CodeMethodMap.cs
- Vector3DConverter.cs
- RuleSetReference.cs
- MemberRelationshipService.cs
- RuleAttributes.cs
- MessageSecurityVersionConverter.cs
- SoapBinding.cs
- AutomationPropertyInfo.cs
- InputScope.cs
- CompositeControl.cs
- UnicastIPAddressInformationCollection.cs
- EventLogPermissionEntryCollection.cs
- PropertyGridEditorPart.cs
- Claim.cs
- Expression.cs
- FileNameEditor.cs
- Control.cs
- CloseSequence.cs
- HtmlWindow.cs
- ClrPerspective.cs
- ConsoleTraceListener.cs
- SoapFault.cs
- MetadataUtil.cs
- MoveSizeWinEventHandler.cs
- HttpTransportElement.cs
- TemplateBindingExpression.cs
- QuaternionConverter.cs
- ListDictionaryInternal.cs
- ColorPalette.cs
- ResXBuildProvider.cs
- WmlLiteralTextAdapter.cs
- XmlRootAttribute.cs
- IOException.cs
- Quaternion.cs
- TypedDataSourceCodeGenerator.cs
- HybridWebProxyFinder.cs
- Site.cs
- HtmlToClrEventProxy.cs
- QilXmlReader.cs
- COM2Properties.cs
- StandardToolWindows.cs
- GridViewRow.cs
- SynchronousChannelMergeEnumerator.cs
- DataExpression.cs
- EntityContainerEntitySet.cs
- PageTrueTypeFont.cs
- HashCodeCombiner.cs
- NamedPipeProcessProtocolHandler.cs