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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IODescriptionAttribute.cs
- XPathExpr.cs
- ZoneIdentityPermission.cs
- Canvas.cs
- Aes.cs
- StrokeNodeData.cs
- InputMethodStateChangeEventArgs.cs
- ArgumentsParser.cs
- RepeatInfo.cs
- Themes.cs
- StandardToolWindows.cs
- WebBrowserDocumentCompletedEventHandler.cs
- QueryCacheManager.cs
- SmiContextFactory.cs
- ColorConverter.cs
- FieldTemplateFactory.cs
- GridViewSelectEventArgs.cs
- ResourcePool.cs
- TextPatternIdentifiers.cs
- SqlAliasesReferenced.cs
- FileDataSourceCache.cs
- HttpApplicationStateWrapper.cs
- XmlElementAttribute.cs
- TransformDescriptor.cs
- NamedPipeConnectionPoolSettings.cs
- SerializationInfoEnumerator.cs
- XPathChildIterator.cs
- EventLogTraceListener.cs
- TypeHelper.cs
- DataStorage.cs
- ComponentResourceKey.cs
- UrlMapping.cs
- ConfigurationSectionGroup.cs
- SymbolEqualComparer.cs
- XMLUtil.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- Schema.cs
- SessionPageStateSection.cs
- SqlDataSourceView.cs
- EncoderExceptionFallback.cs
- UrlPropertyAttribute.cs
- SafeCoTaskMem.cs
- StringUtil.cs
- MembershipValidatePasswordEventArgs.cs
- CompModSwitches.cs
- CodeTypeParameter.cs
- UiaCoreTypesApi.cs
- MultiAsyncResult.cs
- BoundField.cs
- XmlnsDictionary.cs
- LinearKeyFrames.cs
- SoapHelper.cs
- processwaithandle.cs
- EndpointFilterProvider.cs
- MutexSecurity.cs
- ItemDragEvent.cs
- SqlCachedBuffer.cs
- JsonFormatReaderGenerator.cs
- Drawing.cs
- CodeAccessPermission.cs
- SocketPermission.cs
- XPathArrayIterator.cs
- LogoValidationException.cs
- OAVariantLib.cs
- XmlNotation.cs
- returneventsaver.cs
- DataReceivedEventArgs.cs
- BamlRecords.cs
- ExceptionUtil.cs
- ValidationPropertyAttribute.cs
- MetadataItem.cs
- MenuScrollingVisibilityConverter.cs
- FormatConvertedBitmap.cs
- StorageBasedPackageProperties.cs
- ScrollItemProviderWrapper.cs
- ArgumentOutOfRangeException.cs
- ActionFrame.cs
- DiagnosticsConfigurationHandler.cs
- NotifyParentPropertyAttribute.cs
- PEFileEvidenceFactory.cs
- DeferredElementTreeState.cs
- StringSource.cs
- SqlUtils.cs
- SslStream.cs
- WaitForChangedResult.cs
- TextProviderWrapper.cs
- SqlNotificationEventArgs.cs
- WorkflowDefinitionDispenser.cs
- CodeExporter.cs
- ExtractorMetadata.cs
- AsyncInvokeContext.cs
- SecurityUtils.cs
- ipaddressinformationcollection.cs
- SignedXml.cs
- ValidationEventArgs.cs
- DataServiceException.cs
- ActiveXHost.cs
- DataStorage.cs
- FigureHelper.cs
- CFStream.cs