Использование Ninject в рабочем процессе Wcf, размещенном на IIS - PullRequest
2 голосов
/ 28 августа 2011

Я новичок в использовании Ninject в WCF и WF и в настоящее время застрял на том, как я могу использовать инъекцию свойств в примере класса 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
    }
}

Пожалуйста, помогите !!

1 Ответ

1 голос
/ 31 августа 2011
...