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 / Common / EntityRecordInfo.cs / 1 / 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
- SerializationStore.cs
- ReferenceSchema.cs
- Crc32.cs
- Sql8ExpressionRewriter.cs
- FolderBrowserDialog.cs
- ComponentSerializationService.cs
- DataSysAttribute.cs
- AsyncMethodInvoker.cs
- CodeVariableDeclarationStatement.cs
- AppDomainAttributes.cs
- DocumentViewerBase.cs
- AxisAngleRotation3D.cs
- PageBuildProvider.cs
- SoapProtocolReflector.cs
- EpmSyndicationContentSerializer.cs
- CodeTypeMemberCollection.cs
- SoapFaultCodes.cs
- FileDialogCustomPlacesCollection.cs
- FixedTextContainer.cs
- AnnotationResourceChangedEventArgs.cs
- SqlCommand.cs
- ExceptionHandler.cs
- HtmlLink.cs
- DesignTimeValidationFeature.cs
- WebPartMenu.cs
- ConnectionStringsExpressionBuilder.cs
- DataGrid.cs
- AsyncOperationManager.cs
- RIPEMD160Managed.cs
- TextLineResult.cs
- SplineQuaternionKeyFrame.cs
- Events.cs
- ObjectSet.cs
- StylusPointPropertyId.cs
- TransformCollection.cs
- ExpressionBuilder.cs
- GradientStop.cs
- RowParagraph.cs
- Helpers.cs
- PersonalizationStateInfoCollection.cs
- SQLMoneyStorage.cs
- autovalidator.cs
- AssemblyUtil.cs
- DiscreteKeyFrames.cs
- OLEDB_Util.cs
- GridSplitter.cs
- ProxyFragment.cs
- InvalidComObjectException.cs
- DependencyPropertyDescriptor.cs
- PartialTrustHelpers.cs
- ResourcePermissionBaseEntry.cs
- SmtpNtlmAuthenticationModule.cs
- AsymmetricKeyExchangeFormatter.cs
- SQLBinary.cs
- PropertyPathConverter.cs
- SequentialWorkflowHeaderFooter.cs
- CheckBoxFlatAdapter.cs
- TemplateControlBuildProvider.cs
- RegistryPermission.cs
- MouseGestureConverter.cs
- ListViewDeletedEventArgs.cs
- SelfIssuedAuthProofToken.cs
- AnalyzedTree.cs
- CodeExporter.cs
- SafePEFileHandle.cs
- RangeValidator.cs
- XmlQueryType.cs
- MemberInitExpression.cs
- WebPartZoneCollection.cs
- RootBrowserWindow.cs
- Context.cs
- DataSourceSelectArguments.cs
- Shape.cs
- TableAutomationPeer.cs
- CommandEventArgs.cs
- FormCollection.cs
- BridgeDataRecord.cs
- TextPattern.cs
- AdCreatedEventArgs.cs
- WindowsEditBoxRange.cs
- XslAst.cs
- XmlTypeAttribute.cs
- DefaultParameterValueAttribute.cs
- ImageIndexConverter.cs
- storepermission.cs
- SingleObjectCollection.cs
- EntityDataSourceWrapperCollection.cs
- FlowSwitchDesigner.xaml.cs
- SoapAttributes.cs
- WebAdminConfigurationHelper.cs
- URLIdentityPermission.cs
- NaturalLanguageHyphenator.cs
- FactoryMaker.cs
- CodeAttributeArgumentCollection.cs
- XmlNodeReader.cs
- CodeVariableReferenceExpression.cs
- ListBoxItem.cs
- StylusLogic.cs
- PeerNameRecordCollection.cs
- wmiutil.cs