locked
Recommended way to go from code to XAML in Beta 2? RRS feed

  • Question

  • It would appear that there has been a significant shift in some of the internals going from Beta 1 to Beta 2 relating to designing and moving between code and XAML. Classes such as WorkflowElement, ActivitySchemaType and DesignTimeXamlWriter (to name a few) have either been removed, made inaccessible or possibly renamed.

    What is the recommended (high level) way moving forward to go from code to XAML given the changes that have been made?
    Wednesday, October 21, 2009 9:12 PM

Answers

  • As usual, I was missing something incredibly obvious...*sigh*

                return new If()
                {
                    DisplayName = "IfEntityIdEmpty",
                    Condition = new VisualBasicValue<bool>("InputEntity.Id = Guid.Empty"),
                    Then = new Sequence()
                    {...
    • Marked as answer by mdkowalski Friday, October 23, 2009 3:22 PM
    Friday, October 23, 2009 3:22 PM

All replies

  • mdkowalski,

    WorkflowElement has been removed and Activity is now the root of all units of execution.  You can still do all of the same types of things you could have before.

    DesignTimeXamlWriter and DesignTimeXamlReader have been moved over to ActivityXamlServices (you get at them via CreateBuilderReader(), CreateBuilderWriter()).  This was done so that all of our XAML stuff lands in about the same place.

    Additionally, ActivitySchemaType has gone on to become ActivityBuilder, and has moved over to System.Activities out of the Design namespaces. 


    Let me know if that helps,

    matt  
    Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle
    Wednesday, October 21, 2009 9:24 PM
  • I'm behind on my feeds due to playing around with Beta 2 and hadn't gotten to the second of the two posts...thanks for catching me up ;)

    I did have a couple additional questions...

                ActivityBuilder builder = new ActivityBuilder()
                {
                    Name = workflowName,
                    Implementation = new EntityReadFactory().Create(null),
                    Properties =
                    {
                        new DynamicActivityProperty()
                        {
                            Name = "InputEntity",
                            Type = typeof(BusinessEntity)
                        },
                        new DynamicActivityProperty()
                        {
                            Name = "OutputEntity",
                            Type = typeof(BusinessEntity)
                        },
                        new DynamicActivityProperty()
                        {
                            Name = "OutputEntities",
                            Type = typeof(BusinessEntity[])
                        }
                    }
                };

    EntityReadFactory snippet:

                return new If()
                {
                    DisplayName = "IfEntityIdEmpty",
                    Condition = new Equal<Guid, Guid, bool>() 
                    { 
                        Left = new InArgument<Guid>(),
                        Right = new InArgument<Guid>(Guid.Empty)
                    },
                    Then = new Sequence()
                    {
                        DisplayName = "IsEmpty",
                        Variables = { new Variable<BusinessEntity[]>("ReturnedEntities") },
                        Activities = 
                        { 
                            new EntityReadListActivity() 
                            {
                                DisplayName = "ReadEntityList"
                            },
                            new Assign()
                            {
                                DisplayName = "AssignReturnedEntities"
                            }
                        }
                    },
                    Else = new Sequence() 
                    {
                        DisplayName = "IsNotEmpty",
                        Variables = { new Variable<BusinessEntity>("ReturnedEntity") },
                        Activities = 
                        { 
                            new EntityReadActivity() 
                            {
                                DisplayName = "ReadEntity"
                            },
                            new Assign()
                            {
                                DisplayName = "AssignReturnedEntity"
                            }
                        }
                    }
                };

    1) Is it possible to use a property of one of my DynamicActivityPropertys for the left side of the above condition (the standard XAML is '[InputEntity.Id = Guid.Empty]')?
    2) Is it possible to use an OutArgument from 'EntityReadActivity' in conjunction with the Assign activity to set the value of the 'ReturnedEntity' variable i.e. set the proper expression?

    I'm mainly interested in manipulating the expressions around Arguments and Variables within code. Perhaps I'm just missing something obvious...?

    • Edited by mdkowalski Thursday, October 22, 2009 1:09 AM spacing issues
    Thursday, October 22, 2009 1:08 AM
  • As usual, I was missing something incredibly obvious...*sigh*

                return new If()
                {
                    DisplayName = "IfEntityIdEmpty",
                    Condition = new VisualBasicValue<bool>("InputEntity.Id = Guid.Empty"),
                    Then = new Sequence()
                    {...
    • Marked as answer by mdkowalski Friday, October 23, 2009 3:22 PM
    Friday, October 23, 2009 3:22 PM