castle windsor - What is the proper way to call proxied method inside concrete class? -


this question has answer here:

for instance have irepository, implemented repository interceptors.

inside interceptor see irepositoryproxy basetype object , not repository.

for example: resolve irepository , call getfunctionalitypurposes, want call getallfunctionalitypurposes cached/proxied.

this not work since methods invoked in repository not irepositoryproxy.

irepository

functionalitypurpose[] getfunctionalitypurposes(); functionalitypurpose[] getallfunctionalitypurposes() 

repository

[cached("tender")] public virtual functionalitypurpose[] getfunctionalitypurposes() {     var model = getallfunctionalitypurposes()         .where(r => !r.ishidden && !r.groupid.hasvalue);      return model; }  [cached("tender", "functionalitypurpose")] public virtual functionalitypurpose[] getallfunctionalitypurposes() {     var model = unitofwork.getset<model>().select(f => f.functionalitypurpose)         .distinct().orderby(r => r.id).toarray();      return model; } 

i've looked https://github.com/castleproject/windsor/blob/master/src/castle.windsor/windsor/proxy/defaultproxyfactory.cs#l110 , i've done registration easy way: container.register(classes.fromthisassembly().basedon(typeof(irepositorybase<,>)) .withserviceallinterfaces().withserviceself().lifestyletransient());

note .withserviceself() call, switches class-based proxying


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -