Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- Cursors.cs
- TreeViewCancelEvent.cs
- BitmapEffectGroup.cs
- CodeDomSerializerException.cs
- DependencyObjectProvider.cs
- KeyGestureConverter.cs
- RadioButton.cs
- SinglePageViewer.cs
- XmlConvert.cs
- WebRequestModulesSection.cs
- ScriptControlManager.cs
- EntityType.cs
- CodeDirectiveCollection.cs
- RootBrowserWindowProxy.cs
- MergablePropertyAttribute.cs
- DbParameterCollectionHelper.cs
- DataGridViewCellStyle.cs
- FreezableCollection.cs
- DataGridLinkButton.cs
- Parser.cs
- MLangCodePageEncoding.cs
- CapacityStreamGeometryContext.cs
- WorkflowPersistenceService.cs
- WebPartMovingEventArgs.cs
- QuaternionRotation3D.cs
- EpmSyndicationContentSerializer.cs
- StylusButtonEventArgs.cs
- XslException.cs
- ConstrainedDataObject.cs
- UTF8Encoding.cs
- ValidationSummary.cs
- CodeMemberProperty.cs
- AmbiguousMatchException.cs
- ConstructorNeedsTagAttribute.cs
- RunWorkerCompletedEventArgs.cs
- WindowsGraphicsCacheManager.cs
- FontInfo.cs
- ReadOnlyCollectionBase.cs
- HandleCollector.cs
- XmlAttributes.cs
- XXXInfos.cs
- ASCIIEncoding.cs
- SurrogateSelector.cs
- arclist.cs
- RtType.cs
- HttpRequest.cs
- LocalizationComments.cs
- AssociationEndMember.cs
- StreamProxy.cs
- CheckBoxPopupAdapter.cs
- ApplicationInfo.cs
- DataRelationPropertyDescriptor.cs
- CodeStatementCollection.cs
- CfgParser.cs
- PriorityQueue.cs
- HttpPostServerProtocol.cs
- StringUtil.cs
- ChannelEndpointElement.cs
- BindingNavigatorDesigner.cs
- Lazy.cs
- DesignTimeTemplateParser.cs
- Track.cs
- COM2ExtendedUITypeEditor.cs
- WindowsTooltip.cs
- EditingCoordinator.cs
- RSAOAEPKeyExchangeFormatter.cs
- SingleAnimationBase.cs
- InvalidateEvent.cs
- CodeDefaultValueExpression.cs
- ClientType.cs
- Int32CollectionValueSerializer.cs
- TextBoxView.cs
- SrgsDocument.cs
- TripleDESCryptoServiceProvider.cs
- RepeatButtonAutomationPeer.cs
- FilterableAttribute.cs
- BaseDataListActionList.cs
- Variable.cs
- ThreadPool.cs
- DataControlPagerLinkButton.cs
- ProfileSection.cs
- Int32AnimationBase.cs
- WmlValidatorAdapter.cs
- SerializationHelper.cs
- UInt16Converter.cs
- CultureMapper.cs
- SvcMapFileSerializer.cs
- Set.cs
- PropertyKey.cs
- KeyTime.cs
- EntryIndex.cs
- XPathConvert.cs
- ObjectViewListener.cs
- XmlComment.cs
- PreDigestedSignedInfo.cs
- PropertyRef.cs
- ZipFileInfoCollection.cs
- MatrixTransform3D.cs
- DbConnectionPoolCounters.cs
- ImportCatalogPart.cs