WF4 workflow service and entity framework problem
I've got a project with entity framework model in. This model works , because it is also a source in our wcf ria application. ( server)
Now i am trying to create a workflow service , but when i return a list of businessrules(object from the model) in a custom activity, i get the following error when i compile :
Error 4 Compiler error(s) encountered processing expression "BusinessRule". Reference required to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, 开发者_开发技巧PublicKeyToken=b77a5c561934e089' containing the base class 'System.Data.Objects.DataClasses.EntityObject'. Add one to your project.
Anyone an idea? I've added the assembly to my web.config, but that does nothing.
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>();
}
I just found it myself. I had to add System.data.objects.dataclasses to list of imports on the xamlx file, although there was no clear reference to it. Thanks anyway.
Did you add a project reference to the System.Data.Entity assembly from the project containing the CodeActivity?
Code activity has not full access for clr, instead of using CodeActivity use NativeActivity
精彩评论