【问题标题】:WF4 workflow service and entity framework problemWF4工作流服务和实体框架问题
【发布时间】:2013-01-27 05:49:04
【问题描述】:

我有一个带有实体框架模型的项目。这个模型有效,因为它也是我们的 wcf ria 应用程序中的一个源。 (服务器)

现在我正在尝试创建一个工作流服务,但是当我在自定义活动中返回一个业务规则列表(来自模型的对象)时,我在编译时收到以下错误:

错误 4 编译器错误遇到处理表达式“BusinessRule”。 包含基类“System.Data.Objects.DataClasses.EntityObject”的程序集“System.Data.Entity,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”需要参考。将一个添加到您的项目中。

任何人的想法?我已将程序集添加到我的 web.config 中,但这没有任何作用。

public sealed class GetActiveBusinessRulesActivity : CodeActivity<List<BusinessRule>>
{
    // Define an activity input argument of type string
    public InArgument<Customer> Customer { get; set; }

    // If your activity returns a value, derive from CodeActivity<TResult>
    // and return the value from the Execute method.
    protected override List<BusinessRule> Execute(CodeActivityContext context)
    {
        return FilterBusinessRules(Customer.Get(context));
    }

    private List<BusinessRule> FilterBusinessRules(Customer customer)
    {
        var ctxBusinessRules = new AXHintingModuleEntities();


        return ctxBusinessRules.BusinessRules.Where(p => p.Active == true).ToList<BusinessRule>();
    }

【问题讨论】:

    标签: c# entity-framework workflow workflow-foundation-4


    【解决方案1】:

    我自己发现的。我不得不将 System.data.objects.dataclasses 添加到 xamlx 文件的导入列表中,尽管没有明确引用它。还是谢谢。

    【讨论】:

      【解决方案2】:

      您是否从包含 CodeActivity 的项目中添加了对 System.Data.Entity 程序集的项目引用?

      【讨论】:

      • 是的,我做到了。对不起,我忘了添加那个细节。
      • 你是怎么添加这个的?我无法在列表中找到它,如果我将 System.Data.Entity 的引用直接添加到 xaml,它会告诉我它找不到该程序集。
      【解决方案3】:

      代码活动对 clr 没有完全访问权限,而不是使用 CodeActivity 使用 NativeActivity

      【讨论】:

        猜你喜欢
        • 2014-03-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多