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
- Solver.cs
- RpcResponse.cs
- InputScopeAttribute.cs
- SystemDiagnosticsSection.cs
- DataObjectFieldAttribute.cs
- ToolStripMenuItemDesigner.cs
- remotingproxy.cs
- DocumentViewerAutomationPeer.cs
- DbDataRecord.cs
- SQLConvert.cs
- DefaultBinder.cs
- ShapeTypeface.cs
- EdmItemCollection.cs
- DataGridHyperlinkColumn.cs
- Point3DCollection.cs
- RangeValueProviderWrapper.cs
- DrawingContextWalker.cs
- MtomMessageEncodingElement.cs
- TextBreakpoint.cs
- CompilerInfo.cs
- Renderer.cs
- DbConnectionHelper.cs
- PropertyRef.cs
- InternalsVisibleToAttribute.cs
- EmptyControlCollection.cs
- RoleService.cs
- HotSpotCollection.cs
- COM2ICategorizePropertiesHandler.cs
- XsdDataContractExporter.cs
- smtpconnection.cs
- TableCell.cs
- BitmapEncoder.cs
- EntityParameterCollection.cs
- ColorTranslator.cs
- Aes.cs
- CredentialCache.cs
- Table.cs
- NullableConverter.cs
- RegexGroupCollection.cs
- ValueSerializer.cs
- IdentifierElement.cs
- ColumnReorderedEventArgs.cs
- _DigestClient.cs
- RunClient.cs
- SqlUserDefinedAggregateAttribute.cs
- _SafeNetHandles.cs
- GPStream.cs
- Parsers.cs
- Graph.cs
- XmlIterators.cs
- MouseEvent.cs
- StateMachineWorkflow.cs
- ButtonChrome.cs
- CodeDirectiveCollection.cs
- BevelBitmapEffect.cs
- MimeTypeMapper.cs
- parserscommon.cs
- PageThemeBuildProvider.cs
- OracleException.cs
- PageSetupDialog.cs
- RowType.cs
- SslStream.cs
- HitTestWithGeometryDrawingContextWalker.cs
- SystemGatewayIPAddressInformation.cs
- CompositeDataBoundControl.cs
- ContentPosition.cs
- ConfigurationValidatorBase.cs
- StringToken.cs
- IconConverter.cs
- WebPartMinimizeVerb.cs
- PowerModeChangedEventArgs.cs
- PartialTrustVisibleAssembliesSection.cs
- Array.cs
- UnsafeNativeMethods.cs
- MediaElementAutomationPeer.cs
- ChoiceConverter.cs
- WinFormsComponentEditor.cs
- RuntimeConfigLKG.cs
- XmlCharType.cs
- ClientCredentialsSecurityTokenManager.cs
- NameObjectCollectionBase.cs
- BamlRecordHelper.cs
- SafeSecurityHandles.cs
- WebPartConnectionsCancelEventArgs.cs
- EntityTemplateFactory.cs
- CodeVariableReferenceExpression.cs
- XmlArrayItemAttribute.cs
- ClientData.cs
- MimeMultiPart.cs
- ADConnectionHelper.cs
- Span.cs
- ComponentManagerBroker.cs
- FileDataSourceCache.cs
- SubMenuStyleCollection.cs
- EmptyEnumerable.cs
- KeyMatchBuilder.cs
- CodeArrayCreateExpression.cs
- KnownTypesProvider.cs
- ProfileInfo.cs
- SatelliteContractVersionAttribute.cs