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
- WhitespaceRuleLookup.cs
- HttpRuntime.cs
- ActivationWorker.cs
- MemberHolder.cs
- SwitchLevelAttribute.cs
- ProgressChangedEventArgs.cs
- NativeMethods.cs
- ReadOnlyMetadataCollection.cs
- FixedTextBuilder.cs
- StyleCollection.cs
- HtmlInputRadioButton.cs
- DllNotFoundException.cs
- PageTheme.cs
- OleDbReferenceCollection.cs
- CorrelationQueryBehavior.cs
- UTF8Encoding.cs
- OptimalBreakSession.cs
- DropSource.cs
- MemoryPressure.cs
- FusionWrap.cs
- CrossSiteScriptingValidation.cs
- OpacityConverter.cs
- XmlSchemaNotation.cs
- SwitchLevelAttribute.cs
- DictionaryMarkupSerializer.cs
- TextBoxAutomationPeer.cs
- RSAPKCS1SignatureFormatter.cs
- CodePageEncoding.cs
- SecurityElement.cs
- DrawItemEvent.cs
- SqlCommandBuilder.cs
- ElementNotAvailableException.cs
- AudioLevelUpdatedEventArgs.cs
- FontFamily.cs
- processwaithandle.cs
- OracleInfoMessageEventArgs.cs
- RelativeSource.cs
- ToolStripDropDownClosingEventArgs.cs
- XmlValidatingReaderImpl.cs
- XhtmlBasicControlAdapter.cs
- ModelService.cs
- HasCopySemanticsAttribute.cs
- assertwrapper.cs
- ScrollPattern.cs
- bindurihelper.cs
- TextView.cs
- XmlDeclaration.cs
- DecoderFallback.cs
- ApplicationContext.cs
- DataObjectEventArgs.cs
- Expression.DebuggerProxy.cs
- HtmlTitle.cs
- ThicknessKeyFrameCollection.cs
- TreeView.cs
- ReadOnlyDataSourceView.cs
- ConfigXmlAttribute.cs
- ExpressionVisitor.cs
- PropertyEntry.cs
- UserUseLicenseDictionaryLoader.cs
- UnauthorizedWebPart.cs
- ContractMethodInfo.cs
- SecurityPolicySection.cs
- ObjectManager.cs
- ConfigurationSectionCollection.cs
- OracleParameterBinding.cs
- ScriptReferenceBase.cs
- InvalidateEvent.cs
- exports.cs
- CssStyleCollection.cs
- TransformerConfigurationWizardBase.cs
- BinaryMethodMessage.cs
- PasswordBox.cs
- EmbeddedMailObject.cs
- ValidationErrorCollection.cs
- CompoundFileStorageReference.cs
- Inline.cs
- XmlSchemaInferenceException.cs
- BitmapCache.cs
- FullTrustAssembliesSection.cs
- TypeForwardedToAttribute.cs
- Site.cs
- CqlLexer.cs
- EncoderNLS.cs
- ConfigXmlDocument.cs
- PieceNameHelper.cs
- DBSqlParserColumnCollection.cs
- CSharpCodeProvider.cs
- PolicyChain.cs
- DummyDataSource.cs
- TreeNodeSelectionProcessor.cs
- InvalidAsynchronousStateException.cs
- PackagingUtilities.cs
- WebServiceClientProxyGenerator.cs
- FormsAuthenticationConfiguration.cs
- DbDataReader.cs
- CompensatableTransactionScopeActivity.cs
- TextBox.cs
- WebPartVerbsEventArgs.cs
- DataGridViewRowPrePaintEventArgs.cs
- TdsValueSetter.cs