Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Objects / ObjectStateEntryDbUpdatableDataRecord.cs / 1305376 / 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(EntityEntry 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: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } internal ObjectStateEntryDbUpdatableDataRecord(RelationshipEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return (_cacheEntry as RelationshipEntry).GetCurrentRelationValue(ordinal); } else { return (_cacheEntry as EntityEntry).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 as EntityEntry).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(EntityEntry 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: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } internal ObjectStateEntryDbUpdatableDataRecord(RelationshipEntry cacheEntry) : base(cacheEntry) { EntityUtil.CheckArgumentNull(cacheEntry, "cacheEntry"); switch (cacheEntry.State) { case EntityState.Unchanged: case EntityState.Modified: case EntityState.Added: break; default: Debug.Assert(false, "A CurrentValueRecord cannot be created for an entity object that is in a deleted or detached state."); break; } } protected override object GetRecordValue(int ordinal) { if (_cacheEntry.IsRelationship) { return (_cacheEntry as RelationshipEntry).GetCurrentRelationValue(ordinal); } else { return (_cacheEntry as EntityEntry).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 as EntityEntry).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
- DocumentViewer.cs
- TargetConverter.cs
- ColorMap.cs
- ContextTokenTypeConverter.cs
- OutputScopeManager.cs
- MetadataUtilsSmi.cs
- LogEntrySerializer.cs
- ToolStripContainer.cs
- ControlParameter.cs
- WarningException.cs
- ReaderWriterLockSlim.cs
- TemplateContainer.cs
- NetMsmqSecurityElement.cs
- Function.cs
- FragmentQueryKB.cs
- EntryIndex.cs
- UserControl.cs
- ExtensionSimplifierMarkupObject.cs
- MonthCalendar.cs
- SortDescription.cs
- DefaultTextStoreTextComposition.cs
- BlockingCollection.cs
- HtmlEncodedRawTextWriter.cs
- ProviderBase.cs
- QueryAsyncResult.cs
- AliasExpr.cs
- GroupBoxRenderer.cs
- _PooledStream.cs
- ObjectContext.cs
- UrlAuthFailedErrorFormatter.cs
- _NegoState.cs
- GridViewDeletedEventArgs.cs
- PackageDigitalSignatureManager.cs
- ListViewInsertionMark.cs
- RSAOAEPKeyExchangeDeformatter.cs
- NativeMethodsOther.cs
- ComponentGuaranteesAttribute.cs
- NTAccount.cs
- connectionpool.cs
- HwndStylusInputProvider.cs
- GenericTypeParameterConverter.cs
- SQLBinary.cs
- SBCSCodePageEncoding.cs
- IndexedString.cs
- SizeIndependentAnimationStorage.cs
- SkinBuilder.cs
- ImageButton.cs
- safex509handles.cs
- PublisherIdentityPermission.cs
- codemethodreferenceexpression.cs
- UseAttributeSetsAction.cs
- FrameworkContextData.cs
- Debug.cs
- ContentType.cs
- SerTrace.cs
- ValidatorCollection.cs
- CodeSnippetStatement.cs
- SchemaCollectionCompiler.cs
- Message.cs
- Vector3D.cs
- MobileUserControl.cs
- StatusBar.cs
- DragEvent.cs
- SqlError.cs
- HttpProfileBase.cs
- WCFModelStrings.Designer.cs
- HandlerFactoryCache.cs
- PbrsForward.cs
- MailMessageEventArgs.cs
- ComponentDispatcherThread.cs
- BindingGroup.cs
- RSAProtectedConfigurationProvider.cs
- _CommandStream.cs
- EntitySqlQueryCacheEntry.cs
- TextTreeDeleteContentUndoUnit.cs
- GCHandleCookieTable.cs
- HitTestFilterBehavior.cs
- StandardRuntimeEnumValidatorAttribute.cs
- ToolStripItemTextRenderEventArgs.cs
- UniqueEventHelper.cs
- GlyphInfoList.cs
- GradientStop.cs
- GroupedContextMenuStrip.cs
- InvalidProgramException.cs
- TreeViewHitTestInfo.cs
- DetailsViewUpdateEventArgs.cs
- ContextMenu.cs
- DependentTransaction.cs
- Point4DValueSerializer.cs
- DefaultTraceListener.cs
- ParseHttpDate.cs
- SequentialUshortCollection.cs
- ExceptionUtil.cs
- Link.cs
- TextBoxDesigner.cs
- MessagePropertyVariants.cs
- XmlSchemaSimpleContent.cs
- BitArray.cs
- X509CertificateClaimSet.cs
- NamedPipeTransportManager.cs