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
- DetailsViewUpdatedEventArgs.cs
- DbQueryCommandTree.cs
- SHA256Cng.cs
- DetailsViewAutoFormat.cs
- StandardBindingCollectionElement.cs
- ContextToken.cs
- LineSegment.cs
- Nullable.cs
- WebColorConverter.cs
- XmlDataSourceNodeDescriptor.cs
- ChannelDemuxer.cs
- BaseParser.cs
- ParentQuery.cs
- ImageSourceValueSerializer.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- ActivityCollectionMarkupSerializer.cs
- BaseTemplateCodeDomTreeGenerator.cs
- Trace.cs
- StringTraceRecord.cs
- VScrollProperties.cs
- WizardStepBase.cs
- X509Certificate2.cs
- DataErrorValidationRule.cs
- WebPartManager.cs
- XPathChildIterator.cs
- QilUnary.cs
- OleDbCommand.cs
- CodeNamespaceCollection.cs
- SmtpLoginAuthenticationModule.cs
- COSERVERINFO.cs
- FixedBufferAttribute.cs
- DecimalKeyFrameCollection.cs
- HttpResponse.cs
- SoapServerProtocol.cs
- SqlUserDefinedTypeAttribute.cs
- WindowsButton.cs
- VirtualPathUtility.cs
- ButtonColumn.cs
- NullableDoubleMinMaxAggregationOperator.cs
- DelegateSerializationHolder.cs
- DetailsViewUpdatedEventArgs.cs
- Expressions.cs
- MetadataCacheItem.cs
- BuildProviderAppliesToAttribute.cs
- EventDescriptor.cs
- SQLDouble.cs
- TypeReference.cs
- OleDbReferenceCollection.cs
- MessageQueuePermissionEntryCollection.cs
- GeneralTransformGroup.cs
- UserControl.cs
- MulticastNotSupportedException.cs
- RepeaterItemEventArgs.cs
- MappedMetaModel.cs
- ResourceSet.cs
- ObjectDataSourceFilteringEventArgs.cs
- KeyValuePairs.cs
- RequestQueryParser.cs
- StyleBamlTreeBuilder.cs
- ContentAlignmentEditor.cs
- Deflater.cs
- SqlInternalConnectionSmi.cs
- GridProviderWrapper.cs
- EndpointInfo.cs
- SequenceDesignerAccessibleObject.cs
- BitmapEffectGroup.cs
- MetadataCache.cs
- ComPlusTypeLoader.cs
- PinnedBufferMemoryStream.cs
- DescendentsWalker.cs
- MergeFailedEvent.cs
- initElementDictionary.cs
- SoapClientMessage.cs
- RawStylusActions.cs
- PagedDataSource.cs
- ConnectionsZone.cs
- MsmqInputChannelListener.cs
- PromptBuilder.cs
- Encoding.cs
- TextProperties.cs
- RelationshipFixer.cs
- PersonalizableTypeEntry.cs
- SQlBooleanStorage.cs
- ClientProtocol.cs
- ConfigXmlText.cs
- IncomingWebRequestContext.cs
- LinearGradientBrush.cs
- XmlDocument.cs
- ToolStripRenderer.cs
- Menu.cs
- TextFormatterHost.cs
- DocumentEventArgs.cs
- RSAPKCS1SignatureDeformatter.cs
- RegistryPermission.cs
- Config.cs
- StateItem.cs
- ResizingMessageFilter.cs
- EntitySqlQueryCacheEntry.cs
- SpeechDetectedEventArgs.cs
- URLMembershipCondition.cs