Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Objects / Internal / EntityWithKeyStrategy.cs / 1305376 / EntityWithKeyStrategy.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Objects.DataClasses;
using System.Diagnostics;
namespace System.Data.Objects.Internal
{
///
/// Implementor of IEntityKeyStrategy for entities that implement IEntityWithKey. Getting and setting
/// the key is deferred to the entity itself.
///
internal sealed class EntityWithKeyStrategy : IEntityKeyStrategy
{
private IEntityWithKey _entity;
///
/// Creates a strategy object for the given entity. Keys will be stored in the entity.
///
/// The entity to use
public EntityWithKeyStrategy(IEntityWithKey entity)
{
_entity = entity;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKey()
{
return _entity.EntityKey;
}
// See IEntityKeyStrategy
public void SetEntityKey(EntityKey key)
{
_entity.EntityKey = key;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKeyFromEntity()
{
return _entity.EntityKey;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Objects.DataClasses;
using System.Diagnostics;
namespace System.Data.Objects.Internal
{
///
/// Implementor of IEntityKeyStrategy for entities that implement IEntityWithKey. Getting and setting
/// the key is deferred to the entity itself.
///
internal sealed class EntityWithKeyStrategy : IEntityKeyStrategy
{
private IEntityWithKey _entity;
///
/// Creates a strategy object for the given entity. Keys will be stored in the entity.
///
/// The entity to use
public EntityWithKeyStrategy(IEntityWithKey entity)
{
_entity = entity;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKey()
{
return _entity.EntityKey;
}
// See IEntityKeyStrategy
public void SetEntityKey(EntityKey key)
{
_entity.EntityKey = key;
}
// See IEntityKeyStrategy
public EntityKey GetEntityKeyFromEntity()
{
return _entity.EntityKey;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TreeNode.cs
- RestHandler.cs
- ConstructorArgumentAttribute.cs
- ContainerFilterService.cs
- MouseButton.cs
- BrowserCapabilitiesFactory.cs
- BooleanFunctions.cs
- Token.cs
- PropertyDescriptorComparer.cs
- SpeechDetectedEventArgs.cs
- CacheMemory.cs
- RegistryPermission.cs
- JsonXmlDataContract.cs
- LazyInitializer.cs
- WebPartTracker.cs
- QueryCreatedEventArgs.cs
- ServiceObjectContainer.cs
- SystemEvents.cs
- FlowDocumentPage.cs
- RotateTransform.cs
- RectangleF.cs
- Pens.cs
- Highlights.cs
- ServiceMemoryGates.cs
- CacheRequest.cs
- WebPartEditorCancelVerb.cs
- XPathParser.cs
- CounterCreationData.cs
- QilBinary.cs
- BinaryObjectReader.cs
- LogicalMethodInfo.cs
- WorkerRequest.cs
- RichTextBox.cs
- ErrorWebPart.cs
- EUCJPEncoding.cs
- TraceXPathNavigator.cs
- SQLRoleProvider.cs
- AccessDataSource.cs
- AtomContentProperty.cs
- MatchingStyle.cs
- SerializationInfoEnumerator.cs
- SupportsEventValidationAttribute.cs
- WebServiceErrorEvent.cs
- FileDataSourceCache.cs
- ResourceKey.cs
- TextSelectionHighlightLayer.cs
- AssociationTypeEmitter.cs
- FindSimilarActivitiesVerb.cs
- JapaneseCalendar.cs
- ApplicationProxyInternal.cs
- XmlHierarchicalEnumerable.cs
- StylusPointDescription.cs
- XmlSchemaObjectTable.cs
- GeometryDrawing.cs
- DBConnection.cs
- CodeExporter.cs
- StringValueSerializer.cs
- Int32.cs
- SoapTransportImporter.cs
- FillBehavior.cs
- FeatureSupport.cs
- NetMsmqBindingElement.cs
- TemplateControlBuildProvider.cs
- LoggedException.cs
- WindowsHyperlink.cs
- ValidationPropertyAttribute.cs
- SystemWebSectionGroup.cs
- InstanceHandleReference.cs
- PropertyPath.cs
- StorageInfo.cs
- DataException.cs
- NativeMethods.cs
- SRDisplayNameAttribute.cs
- SetMemberBinder.cs
- InkCollectionBehavior.cs
- WsdlBuildProvider.cs
- Queue.cs
- Drawing.cs
- HtmlFormParameterWriter.cs
- RectangleGeometry.cs
- GuidTagList.cs
- HwndSourceKeyboardInputSite.cs
- ToolStripItemImageRenderEventArgs.cs
- FormParameter.cs
- NoResizeSelectionBorderGlyph.cs
- ResourceDisplayNameAttribute.cs
- DataDocumentXPathNavigator.cs
- DefaultAuthorizationContext.cs
- BehaviorDragDropEventArgs.cs
- GridItemProviderWrapper.cs
- PolicyStatement.cs
- Polygon.cs
- RecognitionEventArgs.cs
- XPathAxisIterator.cs
- Debug.cs
- SoundPlayerAction.cs
- HwndHostAutomationPeer.cs
- AuthenticationException.cs
- IpcChannel.cs
- BitmapMetadata.cs