Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Objects / ObjectStateEntryDbUpdatableDataRecord.cs / 1305376 / 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(EntityEntry 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: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } internal ObjectStateEntryDbUpdatableDataRecord(RelationshipEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return (_cacheEntry as RelationshipEntry).GetCurrentRelationValue(ordinal); } else { return (_cacheEntry as EntityEntry).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 as EntityEntry).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(EntityEntry 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: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } internal ObjectStateEntryDbUpdatableDataRecord(RelationshipEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return (_cacheEntry as RelationshipEntry).GetCurrentRelationValue(ordinal); } else { return (_cacheEntry as EntityEntry).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 as EntityEntry).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
- HttpCacheVaryByContentEncodings.cs
- MergeLocalizationDirectives.cs
- QilInvokeLateBound.cs
- LinqDataSourceSelectEventArgs.cs
- TrackBar.cs
- ColorContextHelper.cs
- UnsafeNativeMethodsMilCoreApi.cs
- InvokeGenerator.cs
- EventManager.cs
- InternalSafeNativeMethods.cs
- ServiceContractViewControl.cs
- NullableConverter.cs
- MatrixUtil.cs
- CredentialCache.cs
- NetPeerTcpBindingCollectionElement.cs
- OrthographicCamera.cs
- ProcessInputEventArgs.cs
- PropertyFilterAttribute.cs
- MenuBase.cs
- WpfGeneratedKnownTypes.cs
- IconBitmapDecoder.cs
- InternalResources.cs
- CursorConverter.cs
- MexNamedPipeBindingElement.cs
- InputReferenceExpression.cs
- LocationEnvironment.cs
- ClientReliableChannelBinder.cs
- Int16AnimationUsingKeyFrames.cs
- SingleAnimation.cs
- COM2PictureConverter.cs
- LockedActivityGlyph.cs
- ToolbarAUtomationPeer.cs
- CodeObject.cs
- CultureSpecificStringDictionary.cs
- GraphicsContainer.cs
- CharAnimationBase.cs
- SqlStream.cs
- ExtentCqlBlock.cs
- CompiledRegexRunnerFactory.cs
- ManifestResourceInfo.cs
- ActivationServices.cs
- FileUtil.cs
- Renderer.cs
- KnownTypesHelper.cs
- ToolboxDataAttribute.cs
- ExternalException.cs
- Perspective.cs
- FullTrustAssemblyCollection.cs
- DrawingVisualDrawingContext.cs
- UIElementParaClient.cs
- DynamicMethod.cs
- ListParaClient.cs
- LinqDataSourceContextEventArgs.cs
- GPRECT.cs
- Range.cs
- RegistrationServices.cs
- GridEntry.cs
- SmtpLoginAuthenticationModule.cs
- DoubleLinkList.cs
- VirtualizingStackPanel.cs
- XmlDigitalSignatureProcessor.cs
- AttachedPropertyBrowsableAttribute.cs
- ConfigurationValidatorAttribute.cs
- TextServicesHost.cs
- DataSourceIDConverter.cs
- BlurBitmapEffect.cs
- FixedSOMTableRow.cs
- FontSourceCollection.cs
- ProxyBuilder.cs
- TextSelectionHelper.cs
- EncryptedKeyIdentifierClause.cs
- NetworkStream.cs
- SspiSafeHandles.cs
- Stylesheet.cs
- RoleManagerModule.cs
- ServiceBehaviorElement.cs
- SecurityDocument.cs
- XmlJsonWriter.cs
- SafeThreadHandle.cs
- SecUtil.cs
- TransformPatternIdentifiers.cs
- HtmlInputRadioButton.cs
- DataGridViewComboBoxEditingControl.cs
- TileBrush.cs
- ProcessModelSection.cs
- DetailsViewUpdatedEventArgs.cs
- PageParser.cs
- TransformerConfigurationWizardBase.cs
- EventSetter.cs
- LayoutSettings.cs
- XmlWellformedWriter.cs
- RIPEMD160.cs
- NegatedCellConstant.cs
- FunctionImportElement.cs
- XmlBaseReader.cs
- ObjectDisposedException.cs
- IsolationInterop.cs
- AuthorizationRuleCollection.cs
- QueryResults.cs
- OdbcErrorCollection.cs