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
- SecuritySessionSecurityTokenProvider.cs
- FileDialog_Vista_Interop.cs
- webclient.cs
- WebPartTransformer.cs
- BuildResult.cs
- MethodToken.cs
- EventProvider.cs
- TextSchema.cs
- CodeObject.cs
- IntSecurity.cs
- CodeExporter.cs
- TypedElement.cs
- EventBookmark.cs
- SecurityUtils.cs
- Profiler.cs
- XhtmlBasicTextViewAdapter.cs
- KeyGestureConverter.cs
- CommandBinding.cs
- _BufferOffsetSize.cs
- BitmapCache.cs
- ContextStack.cs
- WeakHashtable.cs
- ToolBarOverflowPanel.cs
- EntityModelBuildProvider.cs
- NativeMethods.cs
- GeometryHitTestResult.cs
- PixelFormats.cs
- DataGridSortCommandEventArgs.cs
- PEFileReader.cs
- WebRequestModulesSection.cs
- MemoryRecordBuffer.cs
- WizardStepCollectionEditor.cs
- Point.cs
- TypeSystem.cs
- TextPattern.cs
- TextServicesDisplayAttribute.cs
- RoleServiceManager.cs
- HtmlToClrEventProxy.cs
- InputProcessorProfiles.cs
- DataGridViewComboBoxCell.cs
- DataServiceResponse.cs
- EventToken.cs
- TableLayout.cs
- _ChunkParse.cs
- TailCallAnalyzer.cs
- EventHandlersStore.cs
- Tracer.cs
- ObjectContextServiceProvider.cs
- XmlDataSource.cs
- SplitterEvent.cs
- XamlInterfaces.cs
- _ConnectOverlappedAsyncResult.cs
- CustomExpression.cs
- WindowsGraphicsWrapper.cs
- FontInfo.cs
- XmlSchemaComplexContentRestriction.cs
- SortKey.cs
- DataSourceCacheDurationConverter.cs
- WaitHandleCannotBeOpenedException.cs
- WindowsTreeView.cs
- InkCanvasSelection.cs
- SerializationInfoEnumerator.cs
- ListViewItemSelectionChangedEvent.cs
- BaseDataListDesigner.cs
- SizeIndependentAnimationStorage.cs
- SerializerDescriptor.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- _OSSOCK.cs
- StreamDocument.cs
- MultiPageTextView.cs
- Cursor.cs
- NumberAction.cs
- List.cs
- MediaElementAutomationPeer.cs
- LiteralLink.cs
- DbConnectionClosed.cs
- RequestCacheValidator.cs
- TimeManager.cs
- UIElementIsland.cs
- HttpCapabilitiesEvaluator.cs
- TaskCanceledException.cs
- MaterialGroup.cs
- Matrix3D.cs
- SizeConverter.cs
- MSAAEventDispatcher.cs
- PathFigureCollectionConverter.cs
- PriorityChain.cs
- CompressionTransform.cs
- FormatConvertedBitmap.cs
- ResourcesBuildProvider.cs
- IMembershipProvider.cs
- AttachInfo.cs
- ModelToObjectValueConverter.cs
- TypeUtil.cs
- exports.cs
- ErrorWebPart.cs
- ConfigurationManagerHelper.cs
- NativeCompoundFileAPIs.cs
- UxThemeWrapper.cs
- PresentationAppDomainManager.cs