Package Sourcedropdown to be ASP.NET vNext (or whatever you called it in the previous screen) you should now see EntityFramework 7 (among other pre-release packages) as shown below.
Startup.cs. You will notice at the top of class is the
bbXPI wanted to add my own json configuration file so my constructor looks like:
ConfigurationManager.AppSettingsaccess as I am used to, I wanted to make a clean method for which to access these configuration options and go one step further to make it strongly typed and utilize dependency injection. So I came up with a quick approach to dynamically populate a class and then use DI to pass the class to my controllers. To get started I wrote a quick function to populate an arbitrary class:
ConfigureServicesfunction also in the
GlobalVarsto the DI list and initialize it with the options from my file. Now to see it in action inside a controller:
Activateattribute on top of the GlobalVars property. Something I'll be adding to this helper method going forward is type inference so the
readConfigmethod would typecast to the type of the property in your arbitrary class.
ASP.NET MVC 4based blog in April 2013 I had making the site responsive from a mobile phone to desktop one of my top priorities when feeling the desire to do web development outside of work. A project at work on the horizon in a few months from now demanded I invest the time in my off-hours to get 100% comfortable with the latest techniques. Along with the responsive design, I redid the routing to take advantage of MVC 5's Attribute based routing and did away with the WCF Service that had been the back bone of my blog for nearly 2 years. The idea being now that you can have MVC and WebAPI services hosted in one solution (ideal for my blog - still not convinced that's a good seperation of concerns for larger enterprise projects), there is no reason for my blog to have 2 seperate solutions.