Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Objects / ObjectStateEntryDbUpdatableDataRecord.cs / 2 / ObjectStateEntryDbUpdatableDataRecord.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Data.Metadata.Edm; using System.Data.Objects; using System.Diagnostics; using System.Reflection; namespace System.Data.Objects { internal sealed class ObjectStateEntryDbUpdatableDataRecord : CurrentValueRecord { internal ObjectStateEntryDbUpdatableDataRecord(ObjectStateEntry cacheEntry, StateManagerTypeMetadata metadata, object userObject) : base(cacheEntry, metadata, userObject) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); EntityUtil.CheckArgumentNull(userObject, "userObject"); EntityUtil.CheckArgumentNull(metadata, "metadata"); Debug.Assert(!cacheEntry.IsKeyEntry, "Cannot create an ObjectStateEntryDbUpdatableDataRecord for a key entry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } internal ObjectStateEntryDbUpdatableDataRecord(ObjectStateEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); Debug.Assert(cacheEntry.IsRelationship, "Wrong ctor is called for entity"); Debug.Assert(!cacheEntry.IsKeyEntry, "Cannot create an ObjectStateEntryDbUpdatableDataRecord for a key entry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return _cacheEntry.GetCurrentRelationValue(ordinal); } else { return _cacheEntry.GetCurrentEntityValue(_metadata, ordinal, _userObject, ObjectStateValueRecord.CurrentUpdatable); } } protected override void SetRecordValue(int ordinal, object value) { if (_cacheEntry.IsRelationship) { // Cannot modify relation values from the public API throw EntityUtil.CantModifyRelationValues(); } else { _cacheEntry.SetCurrentEntityValue(_metadata, ordinal, _userObject, value); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Data.Metadata.Edm; using System.Data.Objects; using System.Diagnostics; using System.Reflection; namespace System.Data.Objects { internal sealed class ObjectStateEntryDbUpdatableDataRecord : CurrentValueRecord { internal ObjectStateEntryDbUpdatableDataRecord(ObjectStateEntry cacheEntry, StateManagerTypeMetadata metadata, object userObject) : base(cacheEntry, metadata, userObject) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); EntityUtil.CheckArgumentNull(userObject, "userObject"); EntityUtil.CheckArgumentNull(metadata, "metadata"); Debug.Assert(!cacheEntry.IsKeyEntry, "Cannot create an ObjectStateEntryDbUpdatableDataRecord for a key entry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } internal ObjectStateEntryDbUpdatableDataRecord(ObjectStateEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); Debug.Assert(cacheEntry.IsRelationship, "Wrong ctor is called for entity"); Debug.Assert(!cacheEntry.IsKeyEntry, "Cannot create an ObjectStateEntryDbUpdatableDataRecord for a key entry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: throw EntityUtil.CannotCreateObjectStateEntryDbUpdatableDataRecord(); } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return _cacheEntry.GetCurrentRelationValue(ordinal); } else { return _cacheEntry.GetCurrentEntityValue(_metadata, ordinal, _userObject, ObjectStateValueRecord.CurrentUpdatable); } } protected override void SetRecordValue(int ordinal, object value) { if (_cacheEntry.IsRelationship) { // Cannot modify relation values from the public API throw EntityUtil.CantModifyRelationValues(); } else { _cacheEntry.SetCurrentEntityValue(_metadata, ordinal, _userObject, value); } } } } // 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
- TextCompositionManager.cs
- Table.cs
- WebPartConnectionsEventArgs.cs
- OutputCacheProfile.cs
- DPTypeDescriptorContext.cs
- TrackingWorkflowEventArgs.cs
- UnsafeNativeMethods.cs
- VersionPair.cs
- MailSettingsSection.cs
- IndependentAnimationStorage.cs
- DataGridGeneralPage.cs
- TouchesOverProperty.cs
- WbemException.cs
- DataControlFieldHeaderCell.cs
- HtmlAnchor.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- DataFieldConverter.cs
- BrushConverter.cs
- IfAction.cs
- MailWebEventProvider.cs
- WebServiceReceiveDesigner.cs
- DropSourceBehavior.cs
- AliasExpr.cs
- EventLogException.cs
- BufferedStream.cs
- TemplateManager.cs
- XmlNamedNodeMap.cs
- PeerReferralPolicy.cs
- TypefaceMetricsCache.cs
- XmlSchemaSimpleContentRestriction.cs
- MatrixTransform.cs
- DllHostedComPlusServiceHost.cs
- DataControlFieldCollection.cs
- Context.cs
- Package.cs
- ParseNumbers.cs
- StandardOleMarshalObject.cs
- AutoGeneratedFieldProperties.cs
- SEHException.cs
- ToolBarTray.cs
- XmlSchemaParticle.cs
- EnumerableWrapperWeakToStrong.cs
- Exceptions.cs
- VisualCollection.cs
- ImageProxy.cs
- ToolStripLabel.cs
- PrefixQName.cs
- ActivationArguments.cs
- TextSelectionHighlightLayer.cs
- StringAttributeCollection.cs
- PropertyEmitter.cs
- TransformProviderWrapper.cs
- TranslateTransform3D.cs
- ListViewSelectEventArgs.cs
- CodeParameterDeclarationExpression.cs
- TextElementEnumerator.cs
- ActivityStatusChangeEventArgs.cs
- NamedElement.cs
- Directory.cs
- DataPointer.cs
- wgx_render.cs
- input.cs
- Thumb.cs
- CompilerScopeManager.cs
- MenuItemBinding.cs
- SizeConverter.cs
- BmpBitmapEncoder.cs
- EffectiveValueEntry.cs
- DeviceFilterEditorDialog.cs
- EncodingNLS.cs
- ImageSource.cs
- SafeMemoryMappedViewHandle.cs
- HasCopySemanticsAttribute.cs
- IsolatedStorageFile.cs
- GridViewSortEventArgs.cs
- SqlDataSourceDesigner.cs
- DefaultBindingPropertyAttribute.cs
- SystemException.cs
- Tokenizer.cs
- ListViewDesigner.cs
- DummyDataSource.cs
- InertiaExpansionBehavior.cs
- PassportAuthenticationModule.cs
- SoapFault.cs
- MetadataProperty.cs
- BufferManager.cs
- MediaPlayer.cs
- MimeTypeAttribute.cs
- StrokeCollection2.cs
- XhtmlBasicPageAdapter.cs
- Funcletizer.cs
- GPPOINTF.cs
- SID.cs
- TrimSurroundingWhitespaceAttribute.cs
- PartialCachingAttribute.cs
- CompileXomlTask.cs
- AuthenticationModuleElementCollection.cs
- Model3D.cs
- PageCache.cs
- ForeignKeyFactory.cs