c# - Call Interface Method from Console Application -
i have web application have class:
public class ptpostalcodeservice : iptpostalcodeservice { private readonly irepository<ptpostalcode> _ptpostalcoderepository; public ptpostalcodeservice(irepository<ptpostalcode> ptpostalcoderepository) { _ptpostalcoderepository = ptpostalcoderepository; } public ptpostalcodedto getptpostalcode(int postalcode, int? postalcodeextension) { ptpostalcode ptpostalcodedomain = new ptpostalcode(); ptpostalcodedomain = _ptpostalcoderepository.get( filter: p => p.postalcode == postalcode && (postalcodeextension.hasvalue == false || p.postalcodeextension == postalcodeextension), includeproperties: "ptcouncil, ptcouncil.ptdistrict").firstordefault(); var ptpostalcodedto = mapper.map<ptpostalcode, ptpostalcodedto>(ptpostalcodedomain); return ptpostalcodedto; } }
now need access methid getptpostalcode consoleapplication, idea?
edit:
i have autofac manage constructors:
// repository builder.registergeneric(typeof(repository<>)) .as(typeof(irepository<>)) .instanceperhttprequest();
the interface of repository:
public interface irepository<t> t : class
thanks.
Comments
Post a Comment