Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Common / EntityRecordInfo.cs / 2 / EntityRecordInfo.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Common { using System.Data; using System.Collections.Generic; using System.Data.Metadata.Edm; using System.Diagnostics; ////// EntityRecordInfo class providing a simple way to access both the type information and the column information. /// public class EntityRecordInfo : DataRecordInfo { private readonly EntityKey _entityKey; private readonly EntitySet _entitySet; ////// /// /// /// /// public EntityRecordInfo(EntityType metadata, IEnumerablememberInfo, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata), memberInfo) { EntityUtil.CheckArgumentNull (entityKey, "entityKey"); EntityUtil.CheckArgumentNull(entitySet, "entitySet"); _entityKey = entityKey; _entitySet = entitySet; ValidateEntityType(entitySet); } /// /// /// /// /// internal EntityRecordInfo(EntityType metadata, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata)) { EntityUtil.CheckArgumentNull(entityKey, "entityKey"); _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } /// /// Reusing TypeUsage and FieldMetadata from another EntityRecordInfo which has all the same info /// but with a different EntityKey instance. /// internal EntityRecordInfo(DataRecordInfo info, EntityKey entityKey, EntitySet entitySet) : base(info) { _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } ////// the EntityKey /// public EntityKey EntityKey { get { return _entityKey; } } // using EntitySetBase versus EntitySet prevents the unnecessary cast of ElementType to EntityType private void ValidateEntityType(EntitySetBase entitySet) { if (!object.ReferenceEquals(RecordType.EdmType, null) && !object.ReferenceEquals(_entityKey, EntityKey.EntityNotValidKey) && !object.ReferenceEquals(_entityKey, EntityKey.NoEntitySetKey) && !object.ReferenceEquals(RecordType.EdmType, entitySet.ElementType) && !entitySet.ElementType.IsBaseTypeOf(RecordType.EdmType)) { throw EntityUtil.Argument(System.Data.Entity.Strings.EntityTypesDoNotAgree); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data.Common { using System.Data; using System.Collections.Generic; using System.Data.Metadata.Edm; using System.Diagnostics; ////// EntityRecordInfo class providing a simple way to access both the type information and the column information. /// public class EntityRecordInfo : DataRecordInfo { private readonly EntityKey _entityKey; private readonly EntitySet _entitySet; ////// /// /// /// /// public EntityRecordInfo(EntityType metadata, IEnumerablememberInfo, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata), memberInfo) { EntityUtil.CheckArgumentNull (entityKey, "entityKey"); EntityUtil.CheckArgumentNull(entitySet, "entitySet"); _entityKey = entityKey; _entitySet = entitySet; ValidateEntityType(entitySet); } /// /// /// /// /// internal EntityRecordInfo(EntityType metadata, EntityKey entityKey, EntitySet entitySet) : base(TypeUsage.Create(metadata)) { EntityUtil.CheckArgumentNull(entityKey, "entityKey"); _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } /// /// Reusing TypeUsage and FieldMetadata from another EntityRecordInfo which has all the same info /// but with a different EntityKey instance. /// internal EntityRecordInfo(DataRecordInfo info, EntityKey entityKey, EntitySet entitySet) : base(info) { _entityKey = entityKey; _entitySet = entitySet; #if DEBUG try { ValidateEntityType(entitySet); } catch { Debug.Assert(false, "should always be valid EntityType when internally constructed"); throw; } #endif } ////// the EntityKey /// public EntityKey EntityKey { get { return _entityKey; } } // using EntitySetBase versus EntitySet prevents the unnecessary cast of ElementType to EntityType private void ValidateEntityType(EntitySetBase entitySet) { if (!object.ReferenceEquals(RecordType.EdmType, null) && !object.ReferenceEquals(_entityKey, EntityKey.EntityNotValidKey) && !object.ReferenceEquals(_entityKey, EntityKey.NoEntitySetKey) && !object.ReferenceEquals(RecordType.EdmType, entitySet.ElementType) && !entitySet.ElementType.IsBaseTypeOf(RecordType.EdmType)) { throw EntityUtil.Argument(System.Data.Entity.Strings.EntityTypesDoNotAgree); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ApplicationInfo.cs
- DoWorkEventArgs.cs
- GenericTextProperties.cs
- HttpListener.cs
- CredentialCache.cs
- HtmlFormWrapper.cs
- AccessDataSourceView.cs
- DataGridViewCheckBoxColumn.cs
- SizeF.cs
- _ConnectOverlappedAsyncResult.cs
- WebPartDisplayModeEventArgs.cs
- DBConcurrencyException.cs
- SpeakInfo.cs
- MouseEvent.cs
- DrawingCollection.cs
- XmlObjectSerializerReadContext.cs
- SchemaManager.cs
- CodeAccessPermission.cs
- _TimerThread.cs
- PairComparer.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- SystemIPInterfaceProperties.cs
- CaseInsensitiveHashCodeProvider.cs
- Latin1Encoding.cs
- ConnectionManagementElementCollection.cs
- DummyDataSource.cs
- DeferredReference.cs
- LinqDataSourceUpdateEventArgs.cs
- EventBuilder.cs
- BypassElementCollection.cs
- ToolStripDesignerAvailabilityAttribute.cs
- PreviewPrintController.cs
- OleDbParameterCollection.cs
- DomainUpDown.cs
- WSSecurityXXX2005.cs
- DynamicDiscoveryDocument.cs
- EndpointNameMessageFilter.cs
- EventHandlerService.cs
- SqlCacheDependencySection.cs
- TransformerInfoCollection.cs
- WeakHashtable.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- DataGridRow.cs
- AuthenticationService.cs
- SimpleRecyclingCache.cs
- NodeCounter.cs
- DataServices.cs
- CustomErrorsSection.cs
- XmlSchemaDatatype.cs
- ForeignConstraint.cs
- ControlPaint.cs
- PageBuildProvider.cs
- Int32Collection.cs
- XmlCDATASection.cs
- CustomPopupPlacement.cs
- ThreadSafeMessageFilterTable.cs
- EmptyReadOnlyDictionaryInternal.cs
- DropTarget.cs
- RedBlackList.cs
- FixedPage.cs
- FixedPage.cs
- WindowsListViewGroupSubsetLink.cs
- Point4DConverter.cs
- DesignerImageAdapter.cs
- RepeaterItem.cs
- TypeSystemHelpers.cs
- PropertyTabChangedEvent.cs
- GridLength.cs
- Latin1Encoding.cs
- XmlILModule.cs
- RuleSettingsCollection.cs
- odbcmetadatafactory.cs
- ProfileBuildProvider.cs
- SqlParameterizer.cs
- MediaTimeline.cs
- SpeechEvent.cs
- CanonicalFormWriter.cs
- FormViewModeEventArgs.cs
- ReaderWriterLock.cs
- FramingEncoders.cs
- SplineKeyFrames.cs
- Volatile.cs
- InkCanvasInnerCanvas.cs
- TileBrush.cs
- CompressedStack.cs
- XhtmlTextWriter.cs
- PersistenceMetadataNamespace.cs
- ListViewUpdateEventArgs.cs
- Sql8ConformanceChecker.cs
- DataRowIndexBuffer.cs
- PassportAuthentication.cs
- HtmlInputCheckBox.cs
- DocumentPageView.cs
- HtmlInputControl.cs
- LayoutEditorPart.cs
- FixedHyperLink.cs
- TypeValidationEventArgs.cs
- NullableLongAverageAggregationOperator.cs
- EUCJPEncoding.cs
- GeneratedCodeAttribute.cs