c# - Register All Classes Manually or there is an automatic way? -


i using asp.net mvc 5. new autofac. have lot of classes , each class have do,

builder.registertype<authenticationservice>().as<iauthenticationservice>(); builder.registertype<iauthenticationrepositry>().as<authenticationrepositry>(); ............................................................................... ............................................................................... 

registering each type time-consuming , quite forget-able. there automatic way register components in autofac?

if want automatically register types as interfaces, can use registerassemblytypes:

builder.registerassemblytypes(typeof(mvcapplication).assembly).asimplementedinterfaces(); 

or asself, if want resolve concrete implementations.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -