惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
D
Docker
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
F
Full Disclosure
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
L
LangChain Blog
H
Help Net Security
B
Blog
T
Tailwind CSS Blog
V
V2EX
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
美团技术团队
A
About on SuperTechFans
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
I
InfoQ
Project Zero
Project Zero
I
Intezer
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threat Research - Cisco Blogs
Last Week in AI
Last Week in AI
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
S
Securelist
Recorded Future
Recorded Future
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 叶小钗
S
Security Affairs
Blog — PlanetScale
Blog — PlanetScale
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
The Hacker News
The Hacker News

博客园 - 生鱼片

Gitlab安装过程 SharePoint 2013即SharePoint 15的一些新特性 关于虚机克隆模板导致无法添加域用户的问题 http header Content-type SharePoint 2010 文档库中直接打开文档 增加一个Export to Spreadsheet的链接 WF4:自定义跟踪参考者 WF4:ETW跟踪参与者 WF4集合Collection相关活动用法 SharePoint 2010 BI(2):使用Visio Service SharePoint 2010 BI (1):Chart WebPart 微软WebMatrix介绍 使用Sharepoint 2007中的webservice操作列表 - 生鱼片 - 博客园 SharePoint中CAML使用的一些总结 使用SharePoint Designer 2010 创建 外部内容类型 WF4:同步执行工作流 - 生鱼片 - 博客园 SharePoint 2010中托管元数据 SharePoint 2010中的客户端模型 SharePoint 2010中的Content Query WebPart
使用SymbolResolver在Activity内访问宿主环境信息
生鱼片 · 2011-03-11 · via 博客园 - 生鱼片

宿主环境内有这样一个数据,如下:

public class MyObject
    {
        public int MyValue { get; set; }
        public string MyString { get; set; }
    }

在Activity内访问该对象实例的方法如下:

public sealed class SymbolUser : CodeActivity
    {
        protected override void Execute(CodeActivityContext context)
        {
            SymbolResolver symbolResolver = context.GetExtension<SymbolResolver>();
            MyObject obj = symbolResolver["CustomObject"] as MyObject;
            Console.WriteLine(obj.MyString);
        }

    }

宿主的代码如下:

class Program
    {
        static void Main(string[] args)
        {
            WorkflowApplication WFApp = new WorkflowApplication(new Workflow1());
            SymbolResolver symbolResolver = new SymbolResolver();
            WFApp.Extensions.Add(symbolResolver);
            symbolResolver.Add("CustomObject", new MyObject() { MyValue = 1, MyString = "TestString" });
            WFApp.Run();
            Console.ReadLine();

        }
    }

当SymbolUser Activity执行的时候就可以得到new MyObject()的属性信息了。