Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / FieldValue.cs / 1305376 / FieldValue.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Expressions { using System.Activities; using System.Activities.Validation; using System.ComponentModel; using System.Reflection; public sealed class FieldValue: CodeActivity { Func operationFunction; [DefaultValue(null)] public string FieldName { get; set; } [DefaultValue(null)] public InArgument Operand { get; set; } protected override void CacheMetadata(CodeActivityMetadata metadata) { bool isRequired = false; if (typeof(TOperand).IsEnum) { metadata.AddValidationError(SR.TargetTypeCannotBeEnum(this.GetType().Name, this.DisplayName)); } if (string.IsNullOrEmpty(this.FieldName)) { metadata.AddValidationError(SR.ActivityPropertyMustBeSet("FieldName", this.DisplayName)); } else { FieldInfo fieldInfo = null; Type operandType = typeof(TOperand); fieldInfo = operandType.GetField(this.FieldName); if (fieldInfo == null) { metadata.AddValidationError(SR.MemberNotFound(this.FieldName, typeof(TOperand).Name)); } else { isRequired = !fieldInfo.IsStatic; ValidationError validationError; if (!MemberExpressionHelper.TryGenerateLinqDelegate(this.FieldName, true, fieldInfo.IsStatic, out this.operationFunction, out validationError)) { metadata.AddValidationError(validationError); } } } MemberExpressionHelper.AddOperandArgument(metadata, this.Operand, isRequired); } protected override TResult Execute(CodeActivityContext context) { TOperand operandValue = this.Operand.Get(context); return this.operationFunction(operandValue); } } } // 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
- GeneralTransform.cs
- HttpPostedFile.cs
- RSAProtectedConfigurationProvider.cs
- QueueSurrogate.cs
- ActivityScheduledRecord.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- ContextMenu.cs
- DataColumnChangeEvent.cs
- Serializer.cs
- SerializationObjectManager.cs
- LabelLiteral.cs
- MsmqChannelFactory.cs
- cookiecollection.cs
- DataGridViewCellLinkedList.cs
- XPathAxisIterator.cs
- InkPresenterAutomationPeer.cs
- BezierSegment.cs
- DataGridViewCellStyleConverter.cs
- SelectionPattern.cs
- DropDownButton.cs
- SQLByte.cs
- NGCSerializationManager.cs
- CheckBoxStandardAdapter.cs
- SizeValueSerializer.cs
- AppAction.cs
- Shape.cs
- Clipboard.cs
- DynamicHyperLink.cs
- LiteralControl.cs
- SqlDataSourceCache.cs
- SrgsDocumentParser.cs
- RenderTargetBitmap.cs
- ProviderConnectionPointCollection.cs
- ControlEvent.cs
- VoiceObjectToken.cs
- AsyncContentLoadedEventArgs.cs
- ListViewDataItem.cs
- CryptoApi.cs
- ScrollChrome.cs
- TraversalRequest.cs
- ExpandedProjectionNode.cs
- DelegateBodyWriter.cs
- RadialGradientBrush.cs
- BehaviorEditorPart.cs
- CorrelationValidator.cs
- EmptyStringExpandableObjectConverter.cs
- webproxy.cs
- CookielessHelper.cs
- StylusPoint.cs
- CriticalExceptions.cs
- ISCIIEncoding.cs
- ObjectManager.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ActivityInterfaces.cs
- CacheAxisQuery.cs
- UIElementPropertyUndoUnit.cs
- CurrentChangingEventManager.cs
- MimeImporter.cs
- WindowsComboBox.cs
- MemberAssignmentAnalysis.cs
- ToolStripSplitStackLayout.cs
- ObjectListFieldCollection.cs
- PropertyFilterAttribute.cs
- Slider.cs
- ClonableStack.cs
- MatrixTransform.cs
- ExchangeUtilities.cs
- IntPtr.cs
- Code.cs
- Group.cs
- XDeferredAxisSource.cs
- TextCompositionManager.cs
- SamlAssertion.cs
- SqlDelegatedTransaction.cs
- HttpTransportSecurity.cs
- CodeStatementCollection.cs
- ExternalFile.cs
- formatter.cs
- SqlDataSourceCustomCommandEditor.cs
- StringUtil.cs
- SystemIPv4InterfaceProperties.cs
- MobileControl.cs
- ServicePointManagerElement.cs
- StorageModelBuildProvider.cs
- RawStylusInputCustomDataList.cs
- SqlStream.cs
- SignatureToken.cs
- DataObjectAttribute.cs
- DBCommand.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- GcHandle.cs
- Stroke.cs
- KeyPressEvent.cs
- StreamInfo.cs
- DateTimeHelper.cs
- ViewStateModeByIdAttribute.cs
- BindingValueChangedEventArgs.cs
- StatusInfoItem.cs
- ADConnectionHelper.cs
- SiteMapDataSourceView.cs