Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / EntityRecordInfo.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Int64KeyFrameCollection.cs
- ScrollPatternIdentifiers.cs
- ControlAdapter.cs
- SamlSerializer.cs
- SplitterEvent.cs
- TempEnvironment.cs
- ObjectPropertyMapping.cs
- GridViewCommandEventArgs.cs
- XmlReturnWriter.cs
- Setter.cs
- QueryCacheKey.cs
- ProxyAttribute.cs
- QueryTreeBuilder.cs
- EntityContainerRelationshipSet.cs
- ButtonChrome.cs
- Model3DGroup.cs
- MenuItemBindingCollection.cs
- LocatorGroup.cs
- HijriCalendar.cs
- IfJoinedCondition.cs
- UnhandledExceptionEventArgs.cs
- SchemaElementDecl.cs
- OdbcParameter.cs
- DataTable.cs
- _CacheStreams.cs
- NumberFormatter.cs
- DataGridTextBox.cs
- DocumentPageHost.cs
- CqlQuery.cs
- IList.cs
- TimeSpanOrInfiniteValidator.cs
- ProvidersHelper.cs
- HWStack.cs
- DataPagerFieldCommandEventArgs.cs
- MimeObjectFactory.cs
- HostProtectionException.cs
- HttpDebugHandler.cs
- ExecutionEngineException.cs
- ElementHost.cs
- XXXInfos.cs
- Viewport3DVisual.cs
- Span.cs
- ObjectStateEntryDbDataRecord.cs
- TimeSpanSecondsConverter.cs
- ControlDesignerState.cs
- UIntPtr.cs
- DesignerVerbCollection.cs
- HttpPostProtocolImporter.cs
- ContentElement.cs
- StringUtil.cs
- SmiConnection.cs
- ConstructorNeedsTagAttribute.cs
- CanonicalFontFamilyReference.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- ZipPackage.cs
- TextTreeExtractElementUndoUnit.cs
- TextView.cs
- ClientConfigurationSystem.cs
- XmlBoundElement.cs
- NumericPagerField.cs
- MenuItemCollection.cs
- ListViewUpdateEventArgs.cs
- ContainerParaClient.cs
- TableDetailsRow.cs
- XmlLoader.cs
- StoryFragments.cs
- SmtpSection.cs
- CodeMethodInvokeExpression.cs
- HandleExceptionArgs.cs
- AccessKeyManager.cs
- SvcFileManager.cs
- NodeLabelEditEvent.cs
- TableItemStyle.cs
- GridEntry.cs
- GraphicsPath.cs
- EventDescriptor.cs
- EdmComplexPropertyAttribute.cs
- ScrollEventArgs.cs
- HtmlShimManager.cs
- XmlDictionaryString.cs
- Vector3DAnimation.cs
- InfoCardListRequest.cs
- MeasureData.cs
- JoinCqlBlock.cs
- InputProcessorProfilesLoader.cs
- StateValidator.cs
- TranslateTransform.cs
- StatusBarItem.cs
- ListItem.cs
- TrustLevelCollection.cs
- PropertyMappingExceptionEventArgs.cs
- Profiler.cs
- InlineCollection.cs
- XmlEventCache.cs
- NamedElement.cs
- Mappings.cs
- ItemDragEvent.cs
- WebPartConnectionsCloseVerb.cs
- BindingUtils.cs
- ArrayListCollectionBase.cs