在IIS上托管的Wcf工作流程上使用Ninject

时间:2011-08-28 10:28:11

标签: wcf workflow ninject

在WCF和WF上使用Ninject是相当新的,目前我仍然坚持如何在CodeActivity类上使用属性注入 实施例

public sealed class TestInjection : CodeActivty
{

    [Inject]
    public IRepository Repository { get; set; }


    // Define an activity input argument of type string
    public InArgument<string> Text { get; set; }

    // If your activity returns a value, derive from CodeActivity<TResult>
    // and return the value from the Execute method.
    protected override void Execute(CodeActivityContext context)
    {
        // Obtain the runtime value of the Text input argument
        string text = context.GetValue(this.Text);
        var name = Repository.GetSomeNAme(); ///Repository is always Null/ never gets injected
    }
}

请帮助!!