Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / EntityModel / SchemaObjectModel / SchemaElementLookUpTable.cs / 1 / 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
- IHttpResponseInternal.cs
- CodeArrayCreateExpression.cs
- DragSelectionMessageFilter.cs
- InputLanguageManager.cs
- WebPartsPersonalization.cs
- TextServicesCompartmentContext.cs
- StorageMappingItemLoader.cs
- diagnosticsswitches.cs
- XamlInt32CollectionSerializer.cs
- CellTreeNode.cs
- RegexReplacement.cs
- EntryIndex.cs
- EdmProviderManifest.cs
- MenuCommandsChangedEventArgs.cs
- BindUriHelper.cs
- XmlIlGenerator.cs
- SqlVersion.cs
- Compiler.cs
- CacheForPrimitiveTypes.cs
- DesignTimeVisibleAttribute.cs
- CodePageEncoding.cs
- nulltextnavigator.cs
- ApplicationManager.cs
- __Filters.cs
- IgnoreFileBuildProvider.cs
- Assembly.cs
- AutoGeneratedFieldProperties.cs
- TextRange.cs
- EntityDataSourceViewSchema.cs
- DBDataPermissionAttribute.cs
- SiteMembershipCondition.cs
- ResourcePermissionBase.cs
- WebPartRestoreVerb.cs
- ActivityScheduledQuery.cs
- TypeCollectionPropertyEditor.cs
- HuffModule.cs
- XmlChildNodes.cs
- DATA_BLOB.cs
- XmlSchemaDatatype.cs
- ColorConvertedBitmap.cs
- COM2ComponentEditor.cs
- SqlDataSourceQueryConverter.cs
- SqlClientWrapperSmiStream.cs
- AssemblyAttributesGoHere.cs
- AlternateViewCollection.cs
- WebPartVerbsEventArgs.cs
- XmlTextReaderImplHelpers.cs
- TypeSchema.cs
- DbXmlEnabledProviderManifest.cs
- DocumentReferenceCollection.cs
- KeyFrames.cs
- FixedTextBuilder.cs
- mactripleDES.cs
- StreamWriter.cs
- SetterBaseCollection.cs
- ResXFileRef.cs
- WebDisplayNameAttribute.cs
- TextAction.cs
- ComponentDispatcher.cs
- complextypematerializer.cs
- SiteMapPath.cs
- OdbcDataAdapter.cs
- _UriTypeConverter.cs
- UrlAuthFailedErrorFormatter.cs
- FixedBufferAttribute.cs
- DataGridTablesFactory.cs
- IdentityValidationException.cs
- dataprotectionpermission.cs
- BamlRecordReader.cs
- PropertyEntry.cs
- SchemaDeclBase.cs
- HandlerFactoryWrapper.cs
- MetadataPropertyCollection.cs
- AppDomainFactory.cs
- Margins.cs
- PersistChildrenAttribute.cs
- DataBoundControl.cs
- ConnectionPointGlyph.cs
- DbProviderFactory.cs
- Transform3D.cs
- XPathDocumentIterator.cs
- ListBoxItem.cs
- RtfToken.cs
- ErrorHandler.cs
- SecurityTokenParametersEnumerable.cs
- ThemeDirectoryCompiler.cs
- ToolstripProfessionalRenderer.cs
- QueryInterceptorAttribute.cs
- RawKeyboardInputReport.cs
- StyleHelper.cs
- ActiveXHost.cs
- serverconfig.cs
- PrintDialogDesigner.cs
- ClassicBorderDecorator.cs
- CommonDialog.cs
- CuspData.cs
- DataSourceControl.cs
- Rules.cs
- SrgsElementFactoryCompiler.cs
- DriveNotFoundException.cs