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
- TextProperties.cs
- SecurityPolicySection.cs
- TcpPortSharing.cs
- GenericUriParser.cs
- ContainerParaClient.cs
- DetailsViewDeleteEventArgs.cs
- SmtpReplyReader.cs
- ExpressionList.cs
- UriExt.cs
- HandlerElement.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- IImplicitResourceProvider.cs
- shaperfactory.cs
- SHA1CryptoServiceProvider.cs
- StructuredTypeEmitter.cs
- ISAPIApplicationHost.cs
- StringSource.cs
- safelink.cs
- DesignerSerializationOptionsAttribute.cs
- SqlLiftWhereClauses.cs
- XmlnsDictionary.cs
- HtmlMeta.cs
- JoinSymbol.cs
- Terminate.cs
- FixedFindEngine.cs
- XPathDocument.cs
- RenderOptions.cs
- SupportsEventValidationAttribute.cs
- AssociationSet.cs
- InvalidCastException.cs
- RequestCache.cs
- HttpResponseHeader.cs
- FormsAuthenticationTicket.cs
- TextParaLineResult.cs
- SqlConnectionFactory.cs
- GridViewHeaderRowPresenter.cs
- ResourceSet.cs
- MeasureItemEvent.cs
- ParserContext.cs
- PaintValueEventArgs.cs
- Graph.cs
- SymLanguageType.cs
- RegistryDataKey.cs
- SchemaLookupTable.cs
- HandleCollector.cs
- ExclusiveCanonicalizationTransform.cs
- ItemCheckedEvent.cs
- PropertyReferenceExtension.cs
- RegexCapture.cs
- initElementDictionary.cs
- DateTimeSerializationSection.cs
- CachedBitmap.cs
- UnionExpr.cs
- EntitySqlException.cs
- TextDecorationCollection.cs
- JsonQueryStringConverter.cs
- MouseDevice.cs
- XmlComplianceUtil.cs
- GenericTransactionFlowAttribute.cs
- DbModificationClause.cs
- ELinqQueryState.cs
- MemberHolder.cs
- WorkflowInstanceTerminatedRecord.cs
- LineSegment.cs
- SRGSCompiler.cs
- WorkflowControlClient.cs
- ProtocolImporter.cs
- HandlerFactoryCache.cs
- TypefaceCollection.cs
- _ListenerAsyncResult.cs
- UnsafeNativeMethods.cs
- SyndicationFeedFormatter.cs
- PanelDesigner.cs
- UpdateProgress.cs
- HttpCachePolicy.cs
- SmiGettersStream.cs
- Pkcs7Signer.cs
- ItemCollection.cs
- PipeSecurity.cs
- PropertyConverter.cs
- ConfigurationValidatorBase.cs
- IdleTimeoutMonitor.cs
- StylusEventArgs.cs
- LabelLiteral.cs
- Inline.cs
- CompensationDesigner.cs
- complextypematerializer.cs
- DateTimeFormat.cs
- DataKey.cs
- CodeTypeParameter.cs
- CodeGroup.cs
- AssemblyGen.cs
- OracleLob.cs
- PolyLineSegmentFigureLogic.cs
- ProcessProtocolHandler.cs
- _TransmitFileOverlappedAsyncResult.cs
- MetadataItem_Static.cs
- DateTimeFormat.cs
- XmlHelper.cs
- SwitchLevelAttribute.cs