Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8280125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:33:27+00:00 2026-06-08T09:33:27+00:00

In a WF4 rehosting Application I need to validate an Activity based on custom

  • 0

In a WF4 rehosting Application I need to validate an Activity based on custom parameters, which are stored in a database.

When the user entered some values and the selection is changed in the designer the overwritten CacheMetadata Method is called as follows:

protected override void CacheMetadata(CodeActivityMetadata metadata)
{
  if (!ParamCache.ContainsKey(InstanceId.ToString())) return;

  var paramsToValidate = ParamCache.Get(InstanceId.ToString());

  var validationErrors = (from paramToValidate in paramsToValidate
      let errorMessage = paramToValidate.Validate()
      where !string.IsNullOrEmpty(errorMessage)
      select new ValidationError(errorMessage, false)).ToList();

 foreach (var validationError in validationErrors)
 {
   metadata.AddValidationError(validationError);
 }
}

During runtime the error collection is evaluated using this Validate Method:

public void Validate()
{
   var activity = ModelItem.GetCurrentValue() as Activity;
   if (activity != null)
   {
       var validationResults = ActivityValidationServices.Validate(activity);

       var designerRegionVieWModel = Parent as DesignerRegionViewModel;
       IsValid = validationResults.Errors.Count <= 0;

       ...       
}

Although ValidationError objects have been added, and IsValid is false the designer is not updated to visualize the errors with the red exclamation mark style.

However, if I add some Errors (for testing purpose) right on the beginning of the CacheMetadata Method the errors are displayed as required.

Could this be some timing problem or is there some additional runtime evaluation which has to be triggered?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:33:28+00:00Added an answer on June 8, 2026 at 9:33 am

    I found out how it works. The entire Workflow needs to be Re-Evaluated. You can achieve this by using the WorkflowDesigner’s ValidationService.

    var validationService = workflowDesigner.Context.Services.GetService<ValidationService>();
    validationService.ValidateWorkflow();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a WF4 activity extension which to handle some long
When you click on a custom activity in a rehosted WF4 designer application, its
Is WF4 suited for end-user situations? For example, I have a application framework built
I am trying to create a custom activity for WF4 that host a child
Using Windows Workflow Foundation WF4, I've got a custom activity with a System.Guid property
I am writing my own custom persistence instance store for WF4, based on the
I've been looking at the possibility of ReHosting a WF4 Workflow to be used
This seems like a simple problem: I have a WF4 activity that guides the
Receive activities in WF4 can take two kind of values, Message or Parameters. Does
I host a wcf workflow service within my ASP.NET MVC2 application. I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.