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
- OpenTypeLayoutCache.cs
- HelloOperation11AsyncResult.cs
- SendParametersContent.cs
- ExecutionContext.cs
- X509ChainPolicy.cs
- TrackingStringDictionary.cs
- TypedAsyncResult.cs
- CounterCreationData.cs
- ActivityAction.cs
- metadatamappinghashervisitor.cs
- SafeRightsManagementHandle.cs
- RowVisual.cs
- Path.cs
- ExpressionConverter.cs
- PointUtil.cs
- SqlTypesSchemaImporter.cs
- TagMapCollection.cs
- CompilationRelaxations.cs
- WindowsRichEdit.cs
- ItemMap.cs
- InputMethodStateTypeInfo.cs
- CommentAction.cs
- XmlQualifiedName.cs
- PageStatePersister.cs
- DiscoveryDocument.cs
- ViewManager.cs
- KeyValueSerializer.cs
- DropShadowEffect.cs
- CornerRadiusConverter.cs
- _HelperAsyncResults.cs
- ActiveDesignSurfaceEvent.cs
- TCPClient.cs
- ErrorBehavior.cs
- EntityReference.cs
- SQLInt32Storage.cs
- CellIdBoolean.cs
- WindowsToolbar.cs
- HostSecurityManager.cs
- TagPrefixAttribute.cs
- LocalizableResourceBuilder.cs
- AdRotatorDesigner.cs
- ControlAdapter.cs
- DateTime.cs
- Lazy.cs
- figurelength.cs
- BufferModeSettings.cs
- CodeGenerator.cs
- ConfigErrorGlyph.cs
- UInt16Storage.cs
- CharUnicodeInfo.cs
- BuilderElements.cs
- pingexception.cs
- PropertyValueChangedEvent.cs
- CanonicalFontFamilyReference.cs
- LocatorBase.cs
- FormsAuthenticationConfiguration.cs
- QilSortKey.cs
- TraceRecord.cs
- FormParameter.cs
- AstNode.cs
- Container.cs
- XmlSchemaValidationException.cs
- XmlSchemaChoice.cs
- SerTrace.cs
- HTTPNotFoundHandler.cs
- KeyBinding.cs
- SafeRightsManagementPubHandle.cs
- MulticastOption.cs
- ProxyFragment.cs
- PageStatePersister.cs
- EntityDataSourceContextCreatedEventArgs.cs
- Propagator.Evaluator.cs
- Trace.cs
- HyperLinkColumn.cs
- GridViewDesigner.cs
- GAC.cs
- ExceptionHandlers.cs
- Figure.cs
- StateRuntime.cs
- InfiniteTimeSpanConverter.cs
- BitmapEffectGroup.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- AutoFocusStyle.xaml.cs
- HuffModule.cs
- WorkflowServiceBehavior.cs
- Panel.cs
- SelectedDatesCollection.cs
- ScrollItemPattern.cs
- Single.cs
- AutomationPeer.cs
- OpenTypeLayout.cs
- XmlSortKeyAccumulator.cs
- Restrictions.cs
- ADMembershipProvider.cs
- BindingManagerDataErrorEventArgs.cs
- SystemResourceHost.cs
- DocumentManager.cs
- QilGeneratorEnv.cs
- TextEditorCopyPaste.cs
- MatrixTransform.cs