Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Objects / ObjectStateEntryDbUpdatableDataRecord.cs / 1 / 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
- GenericRootAutomationPeer.cs
- ProviderConnectionPointCollection.cs
- ManipulationDeltaEventArgs.cs
- MulticastNotSupportedException.cs
- ContractReference.cs
- SqlClientWrapperSmiStream.cs
- AppDomainCompilerProxy.cs
- TransactionProxy.cs
- GenericXmlSecurityTokenAuthenticator.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- SortedDictionary.cs
- XsdDuration.cs
- ProcessHostMapPath.cs
- AdRotator.cs
- WebSysDescriptionAttribute.cs
- InProcStateClientManager.cs
- ApplicationException.cs
- BufferedStream.cs
- Int64Converter.cs
- UntypedNullExpression.cs
- GridViewAutoFormat.cs
- UITypeEditor.cs
- RoutedEventHandlerInfo.cs
- OleDbParameter.cs
- DataGridViewRowEventArgs.cs
- LOSFormatter.cs
- XmlDocumentSerializer.cs
- CursorInteropHelper.cs
- PeerCredential.cs
- ProxyManager.cs
- BCryptHashAlgorithm.cs
- Italic.cs
- BlurBitmapEffect.cs
- XmlSchemaChoice.cs
- CommandValueSerializer.cs
- Focus.cs
- ClientSettingsSection.cs
- TextSyndicationContent.cs
- XhtmlCssHandler.cs
- CellPartitioner.cs
- CssStyleCollection.cs
- OraclePermission.cs
- ExtentCqlBlock.cs
- BamlTreeNode.cs
- TextTreeTextNode.cs
- PageCache.cs
- oledbconnectionstring.cs
- DataObjectEventArgs.cs
- Point3DValueSerializer.cs
- CodeExporter.cs
- ObjectDataSourceMethodEventArgs.cs
- MdiWindowListStrip.cs
- GC.cs
- CompilerWrapper.cs
- StoryFragments.cs
- Timer.cs
- SQLInt64.cs
- WindowPatternIdentifiers.cs
- ArrayTypeMismatchException.cs
- RegexRunner.cs
- WebPartManagerInternals.cs
- Constraint.cs
- FormsAuthenticationTicket.cs
- Monitor.cs
- CardSpaceShim.cs
- HttpRuntime.cs
- OuterGlowBitmapEffect.cs
- ValidationErrorEventArgs.cs
- DataGridRowHeader.cs
- SingleStorage.cs
- SignatureHelper.cs
- AudioBase.cs
- AssociationTypeEmitter.cs
- SerializerDescriptor.cs
- ObjectReferenceStack.cs
- EventHandlerList.cs
- FlowLayoutSettings.cs
- ConsumerConnectionPointCollection.cs
- XmlDesigner.cs
- ComponentManagerBroker.cs
- Baml2006ReaderSettings.cs
- PointHitTestParameters.cs
- RuntimeVariableList.cs
- TextBoxBase.cs
- OleDbReferenceCollection.cs
- XmlQueryCardinality.cs
- Comparer.cs
- WebDisplayNameAttribute.cs
- UInt32.cs
- FixedTextPointer.cs
- GenericWebPart.cs
- HashCodeCombiner.cs
- RegionData.cs
- EmptyStringExpandableObjectConverter.cs
- DataSourceHelper.cs
- EpmContentSerializerBase.cs
- DrawToolTipEventArgs.cs
- DependencySource.cs
- XsltSettings.cs
- AggregateNode.cs