Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Validation / Constraint.cs / 1305376 / Constraint.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Validation { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime; using System.Windows.Markup; using System.Collections.ObjectModel; public abstract class Constraint : NativeActivity { public const string ValidationErrorListPropertyName = "System.Activities.Validation.Constraint.ValidationErrorList"; internal const string ToValidateArgumentName = "ToValidate"; internal const string ValidationErrorListArgumentName = "ViolationList"; internal const string ToValidateContextArgumentName = "ToValidateContext"; RuntimeArgument toValidate; RuntimeArgument violationList; RuntimeArgument toValidateContext; internal Constraint() { this.toValidate = new RuntimeArgument(ToValidateArgumentName, typeof(object), ArgumentDirection.In); this.toValidateContext = new RuntimeArgument(ToValidateContextArgumentName, typeof(ValidationContext), ArgumentDirection.In); this.violationList = new RuntimeArgument(ValidationErrorListArgumentName, typeof(IList), ArgumentDirection.Out); } public static void AddValidationError(NativeActivityContext context, ValidationError error) { List validationErrorList = context.Properties.Find(ValidationErrorListPropertyName) as List ; if (validationErrorList == null) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.AddValidationErrorMustBeCalledFromConstraint(typeof(Constraint).Name))); } validationErrorList.Add(error); } protected override void CacheMetadata(NativeActivityMetadata metadata) { metadata.SetArgumentsCollection( new Collection { this.toValidate, this.violationList, this.toValidateContext }); } protected override void Execute(NativeActivityContext context) { object objectToValidate = this.toValidate.Get
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- KeyValuePairs.cs
- PropertyIDSet.cs
- ButtonFieldBase.cs
- TimeEnumHelper.cs
- InheritanceContextChangedEventManager.cs
- Codec.cs
- DataSetViewSchema.cs
- TimeSpanSecondsConverter.cs
- ScrollChrome.cs
- BinaryHeap.cs
- SQLGuidStorage.cs
- ForwardPositionQuery.cs
- PerformanceCounterLib.cs
- SerializationStore.cs
- dataprotectionpermission.cs
- RegexCaptureCollection.cs
- SchemaImporterExtensionElement.cs
- Int16AnimationBase.cs
- SqlTopReducer.cs
- ComponentDispatcher.cs
- Label.cs
- QueryCursorEventArgs.cs
- FixedTextSelectionProcessor.cs
- UseAttributeSetsAction.cs
- DataGridViewCellPaintingEventArgs.cs
- XmlDataContract.cs
- XmlNotation.cs
- ConfigurationStrings.cs
- versioninfo.cs
- ToolStripOverflowButton.cs
- MsmqIntegrationMessageProperty.cs
- ExecutionContext.cs
- TimelineCollection.cs
- CollectionEditor.cs
- InheritanceContextChangedEventManager.cs
- ProgramPublisher.cs
- DateTimeEditor.cs
- Span.cs
- XslException.cs
- DescendantOverDescendantQuery.cs
- EventProxy.cs
- KerberosTicketHashIdentifierClause.cs
- x509utils.cs
- RouteParametersHelper.cs
- SpellerHighlightLayer.cs
- StructuralObject.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- TdsParserSafeHandles.cs
- SemanticResultKey.cs
- SchemaImporterExtensionElement.cs
- SqlDataSourceStatusEventArgs.cs
- SafeNativeMethods.cs
- Page.cs
- CheckBox.cs
- Error.cs
- ColumnMapCopier.cs
- ColorDialog.cs
- XPathEmptyIterator.cs
- StateWorkerRequest.cs
- ITreeGenerator.cs
- ServerValidateEventArgs.cs
- ListItemCollection.cs
- QueryStringConverter.cs
- DataColumnPropertyDescriptor.cs
- PtsHelper.cs
- CompositeScriptReference.cs
- CodeTypeDeclaration.cs
- ComPlusDiagnosticTraceRecords.cs
- BitVec.cs
- ListViewTableCell.cs
- PeerNearMe.cs
- _CookieModule.cs
- FontStyles.cs
- SessionState.cs
- SqlServices.cs
- FloaterParagraph.cs
- x509store.cs
- SymmetricCryptoHandle.cs
- PropertyValueUIItem.cs
- CornerRadius.cs
- EventLogPermissionEntry.cs
- TimelineGroup.cs
- TextParagraphCache.cs
- TdsParserHelperClasses.cs
- FileDetails.cs
- CompressStream.cs
- DynamicHyperLink.cs
- DirectionalLight.cs
- sortedlist.cs
- ObjRef.cs
- UnsafeNativeMethods.cs
- QuaternionKeyFrameCollection.cs
- RepeatInfo.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- Int16Animation.cs
- StylusTip.cs
- FormClosingEvent.cs
- XhtmlBasicLiteralTextAdapter.cs
- DBSchemaRow.cs
- AxHost.cs