Registering a service using Autofac and getting the list of services via Container in MVC Controller

Using a DI framework (I am using Autofac in my case), you can register the services like below  in AutofacConfig.cs class inside Configure() method as below var builder = new ContainerBuilder(); builder.RegisterType<MyClass>().As<IMyInterface>(); Now you can loop through the list of services in the container .You can either get the entire list of services , or […]

Storing string with Enums in VB.Net

Below is one of the ways to store/retrieve   string data type using Enums . This is particularly useful in situations where  you have to deal with string values repeatedly in your project and don’t want to run into gotcha errors because you mistyped a string . Imagine an  Event logger  where you log multiple error […]