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
- InternalMappingException.cs
- DataGridViewRowPostPaintEventArgs.cs
- CodeTypeOfExpression.cs
- Exception.cs
- AssociationSetEnd.cs
- MediaSystem.cs
- WebEventCodes.cs
- EastAsianLunisolarCalendar.cs
- StateDesigner.cs
- EngineSiteSapi.cs
- SwitchAttribute.cs
- Events.cs
- DataViewManagerListItemTypeDescriptor.cs
- ELinqQueryState.cs
- MultiByteCodec.cs
- BitmapMetadataBlob.cs
- _LocalDataStoreMgr.cs
- XmlHierarchicalDataSourceView.cs
- XmlObjectSerializer.cs
- UniqueID.cs
- UriTemplateTrieLocation.cs
- WebPartCancelEventArgs.cs
- TagPrefixCollection.cs
- VerificationException.cs
- ItemTypeToolStripMenuItem.cs
- CheckableControlBaseAdapter.cs
- SharedPersonalizationStateInfo.cs
- SafeRightsManagementSessionHandle.cs
- SvcMapFile.cs
- CellTreeNodeVisitors.cs
- TreeNodeEventArgs.cs
- TextEditorCopyPaste.cs
- PagedDataSource.cs
- Keywords.cs
- DecoderExceptionFallback.cs
- NullToBooleanConverter.cs
- PagerSettings.cs
- XmlDocumentSurrogate.cs
- ErrorHandler.cs
- StringSource.cs
- TableLayoutPanelCodeDomSerializer.cs
- mil_commands.cs
- EpmCustomContentSerializer.cs
- ByteBufferPool.cs
- NumberFunctions.cs
- DataGridPageChangedEventArgs.cs
- XNameTypeConverter.cs
- BaseResourcesBuildProvider.cs
- ViewStateException.cs
- CodeTypeParameter.cs
- SwitchAttribute.cs
- DateTimeParse.cs
- BrowserCapabilitiesCompiler.cs
- RegexStringValidatorAttribute.cs
- ForeignConstraint.cs
- DtdParser.cs
- QilValidationVisitor.cs
- FixedLineResult.cs
- GridViewSortEventArgs.cs
- RoutedEvent.cs
- UpdatePanel.cs
- BinHexEncoder.cs
- SchemeSettingElement.cs
- COM2ComponentEditor.cs
- ToolStripPanelRenderEventArgs.cs
- sitestring.cs
- InvokeProviderWrapper.cs
- ListBoxAutomationPeer.cs
- DataBoundLiteralControl.cs
- ManagementObject.cs
- XmlQualifiedName.cs
- HtmlControl.cs
- IssuanceLicense.cs
- PrintPageEvent.cs
- Attachment.cs
- ValueTable.cs
- DataGridViewRowEventArgs.cs
- AnchoredBlock.cs
- SQLDateTime.cs
- ScrollEvent.cs
- FrugalMap.cs
- UpdateTracker.cs
- AsymmetricSecurityProtocolFactory.cs
- BinaryObjectWriter.cs
- ExpressionLexer.cs
- Peer.cs
- EntityCollection.cs
- SymbolMethod.cs
- EntityDataSourceContainerNameConverter.cs
- IgnoreSection.cs
- GenericRootAutomationPeer.cs
- QueryableFilterUserControl.cs
- PriorityRange.cs
- TypeValidationEventArgs.cs
- CatalogPartChrome.cs
- SequentialOutput.cs
- InputElement.cs
- securitycriticaldataformultiplegetandset.cs
- ZipQueryOperator.cs
- TextRangeEditLists.cs