Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- AsyncInvokeContext.cs
- TraceListeners.cs
- InterleavedZipPartStream.cs
- DrawListViewColumnHeaderEventArgs.cs
- StateManagedCollection.cs
- IConvertible.cs
- Transaction.cs
- CodeSubDirectory.cs
- RoutedPropertyChangedEventArgs.cs
- TargetConverter.cs
- MouseWheelEventArgs.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- ScopelessEnumAttribute.cs
- Highlights.cs
- _AuthenticationState.cs
- ProfileInfo.cs
- DbConnectionStringCommon.cs
- TextEditorTables.cs
- KeyValueSerializer.cs
- TransactionInformation.cs
- LightweightEntityWrapper.cs
- WebPartDisplayModeEventArgs.cs
- TableMethodGenerator.cs
- Compiler.cs
- TextElementCollectionHelper.cs
- ContainsRowNumberChecker.cs
- ListViewItemSelectionChangedEvent.cs
- StrokeNode.cs
- BufferedWebEventProvider.cs
- UnsafePeerToPeerMethods.cs
- ParameterToken.cs
- MULTI_QI.cs
- Hashtable.cs
- DrawingContextDrawingContextWalker.cs
- DocumentViewerBaseAutomationPeer.cs
- SessionMode.cs
- XmlSchema.cs
- UpdatePanelTrigger.cs
- QilPatternFactory.cs
- EntityClassGenerator.cs
- PrintDocument.cs
- MdiWindowListStrip.cs
- EmptyEnumerator.cs
- HttpBindingExtension.cs
- SiteOfOriginPart.cs
- DataBindingExpressionBuilder.cs
- XmlName.cs
- XhtmlTextWriter.cs
- AnnotationDocumentPaginator.cs
- OleDbDataReader.cs
- PointLight.cs
- HMACSHA512.cs
- HttpClientCertificate.cs
- OleServicesContext.cs
- CheckBox.cs
- TreeNodeEventArgs.cs
- AxisAngleRotation3D.cs
- ToolStripManager.cs
- SecurityKeyUsage.cs
- CompiledQuery.cs
- ToolStripProgressBar.cs
- QilInvokeLateBound.cs
- DBPropSet.cs
- Win32Native.cs
- SingleResultAttribute.cs
- COAUTHINFO.cs
- EmptyImpersonationContext.cs
- FileCodeGroup.cs
- WebPartConnectionsConnectVerb.cs
- ExecutionEngineException.cs
- CopyOfAction.cs
- ReferencedCollectionType.cs
- URLAttribute.cs
- WindowsContainer.cs
- WorkflowRuntimeServiceElement.cs
- DataGridViewSelectedColumnCollection.cs
- CaseStatementProjectedSlot.cs
- RelationshipEndCollection.cs
- EntityDataSource.cs
- XomlCompilerHelpers.cs
- Vector3D.cs
- DependencyObject.cs
- DescendantOverDescendantQuery.cs
- AssemblyEvidenceFactory.cs
- SqlAliaser.cs
- SqlDataSourceCommandEventArgs.cs
- SafeNativeMethods.cs
- AppDomain.cs
- PackageDocument.cs
- StrokeCollectionConverter.cs
- TextEditorLists.cs
- SizeAnimationUsingKeyFrames.cs
- ModifierKeysValueSerializer.cs
- DiscriminatorMap.cs
- HtmlInputFile.cs
- CompatibleComparer.cs
- X500Name.cs
- Table.cs
- ToolStripDropDownMenu.cs
- Properties.cs