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
- ByteStreamBufferedMessageData.cs
- CompoundFileStreamReference.cs
- ExpressionBuilderContext.cs
- ComponentCache.cs
- DiscoveryDocumentReference.cs
- FormViewUpdateEventArgs.cs
- HeaderPanel.cs
- HttpHandlerAction.cs
- AuthenticationException.cs
- GridView.cs
- UpdateRecord.cs
- ResourceReader.cs
- TriggerAction.cs
- wgx_render.cs
- PagePropertiesChangingEventArgs.cs
- HyperLinkStyle.cs
- SkewTransform.cs
- StateMachineAction.cs
- XmlWriterSettings.cs
- ListControlConvertEventArgs.cs
- EncodingFallbackAwareXmlTextWriter.cs
- IISUnsafeMethods.cs
- DynamicPropertyReader.cs
- TextServicesCompartmentEventSink.cs
- CharacterMetricsDictionary.cs
- SelfIssuedAuthProofToken.cs
- RuntimeIdentifierPropertyAttribute.cs
- ExpressionParser.cs
- safesecurityhelperavalon.cs
- ColorPalette.cs
- TypeConverterAttribute.cs
- ProtocolElementCollection.cs
- ObfuscationAttribute.cs
- Rules.cs
- AsymmetricSignatureFormatter.cs
- FloatSumAggregationOperator.cs
- URIFormatException.cs
- Overlapped.cs
- Calendar.cs
- AutomationTextAttribute.cs
- IWorkflowDebuggerService.cs
- SystemTcpConnection.cs
- PageThemeParser.cs
- RealProxy.cs
- ListViewSelectEventArgs.cs
- SafeCryptoHandles.cs
- PenThread.cs
- FormViewModeEventArgs.cs
- XPathScanner.cs
- ContextMenuService.cs
- MailAddress.cs
- CompilerParameters.cs
- OleDbConnectionInternal.cs
- FamilyMap.cs
- EmptyEnumerator.cs
- ValueType.cs
- XmlWrappingWriter.cs
- UIElementCollection.cs
- ClonableStack.cs
- SmtpNetworkElement.cs
- Ops.cs
- SmiRecordBuffer.cs
- DataGridViewColumnTypePicker.cs
- InkCanvasInnerCanvas.cs
- List.cs
- METAHEADER.cs
- JsonObjectDataContract.cs
- XmlWellformedWriterHelpers.cs
- WhitespaceRuleLookup.cs
- TripleDESCryptoServiceProvider.cs
- Int32KeyFrameCollection.cs
- _KerberosClient.cs
- SqlStatistics.cs
- ContextMenuService.cs
- xml.cs
- WebPermission.cs
- ConfigurationManagerInternal.cs
- RegionData.cs
- HttpHandlerAction.cs
- XmlToDatasetMap.cs
- TextEmbeddedObject.cs
- RoutedUICommand.cs
- ClientType.cs
- PluralizationServiceUtil.cs
- RulePatternOps.cs
- SymDocumentType.cs
- DataTable.cs
- ParenExpr.cs
- XmlUtil.cs
- TransformedBitmap.cs
- BitmapEffectvisualstate.cs
- PrefixHandle.cs
- login.cs
- AssemblyUtil.cs
- HierarchicalDataSourceControl.cs
- AnimationLayer.cs
- BufferAllocator.cs
- CodeDOMUtility.cs
- ExceptionTranslationTable.cs
- ZipIOCentralDirectoryDigitalSignature.cs