latest posts

As a frequent or infrequent visitor might have noticed, the site has undergone a slight refresh. I kept the bootstrap menu, but stripped out the right hand panel (though it might come back in a different form). The biggest undertaking was the complete rewrite of the codebase from the ASP NET MVC 5 and Entity Framework 6.1 to ASP NET Core and Entity Framework Core. The code base is now considerably smaller and as you can tell is faster without caching even turned on as it was before.

As my shift in time spent has shifted from blogging to my GitHub projects, I wanted to shift focus of my blog to my github projects. Over the next couple weeks I will be adding in some feeds and milestones of the projects I am working in the header area. This way a visitor might notice I had not blogged in a while, but can see active progress on GitHub.

That being said I have been dividing my time between a couple different projects. One being bbXP, the codebase that powers this blog. The other being jcFUS, a collaboration tool for businesses and consumers. In the coming weeks expect a lot of coverage on these projects.

One might be asking, where is the updated code for bbXP? I will be pollishing it up today and checking it into the GitHub repository.

Some other features coming back at some point:
  • Archives
  • Content Search
  • White Papers
  • My Computers
So stay tuned for more updates and some other posts on the hardware side of my passion.
Continuing my work deep diving into ASP.NET 5 (vNext), I started going down the path of EntityFramework 7. Which similiarly to ASP.NET 5, is like a reboot of the framework itself. Readers interested to dive in, I highly suggest you watch the MVA Video called What's New with ASP.NET 5 that goes over all of the changes in pretty good detail (though I have a running questions list to ask at BUILD in a few weeks).

Noting that EntityFramework 7 beta was included in my ASP.NET 5 project, I hit a road block into finding it through the usual method in the NuGet Package Manager. As of this writing, only 6.1.3 was available. In looking around, the answer is to add another NuGet Package Source. I had done this previously as I setup a private NuGet Package Server at work to host common libraries used throughout all of our projects. For those unaware, goto Tools->NuGet Package Manager->Package Manager Settings.

Once there, click on Package Sources and then the + icon, enter a descriptive name and for the source and paste the following url: https://www.myget.org/F/aspnetvnext/ and click Update. After you're done, you should have something similiar to this:



You can now close out that window and return to the NuGet Package Manager and upon switching the Package Source dropdown 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.



Hopefully that helps someone out there wanting to deep dive into EntityFramework 7.

Per my announcement on Sunday, I'm working on making bbXP (my CMS that runs this site) generic to the point where anyone could just use it with minimal configuration/customizations. Along this journey, I'm going to be utilizing all of the new ASP.NET 5 (vNext) features. This way I'll be able to use my platform as a test bed for all of the new features of ASP.NET 5 and then apply to production products at work, much like what Version 1 was in back in day when I wanted to deep dive into PHP and MySQL back in 2003 and MVC in general almost 2 years ago.

Tonight's deep dive was into the new configuration model. If you've been developing for ASP.NET or .NET in general you're probably accustomed to using either the app.config or the web.config like .

And then in your app you would do something like this:

[csharp] var siteName = ConfigurationManager.AppSettings["SITE_NAME"]; [/csharp] And if you got a little fancier you would add a wrapper in your base page or controller to return typed properties for booleans or integers.

With ASP.NET 5, configuration is completely new and extremely flexible, but with the same end result. I will assume you have at the very least downloaded and installed the Visual Studio 2015 CTP in addition to launching the ASP.NET 5 template to at least get somewhat comfortable with all the changes. If you are just starting, I highly suggest watching Daniel Roth's introduction video.

To dive into the configuration specifically, you will want to open the Startup.cs. You will notice at the top of class is the Startup constructor. For bbXP I wanted to add my own json configuration file so my constructor looks like:
[csharp] public Startup(IHostingEnvironment env) { Configuration = new Configuration() .AddJsonFile("config.json") .AddJsonFile("bbxpconfig.json"); } [/csharp] Knowing I would not have the same ConfigurationManager.AppSettings access 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:

[csharp] private T readConfig() { var tmpObject = Activator.CreateInstance(); var objectType = tmpObject.GetType(); IList props = new List(objectType.GetProperties()); var className = objectType.Name; foreach (var prop in props) { var cfgValue = Configuration.Get(String.Format("{0}:{1}", className, prop.Name)); prop.SetValue(tmpObject, cfgValue, null); } return tmpObject; } [/csharp] And then my arbitrary class:

[csharp] public class GlobalVars { public string SITE_NAME { get; set; } } [/csharp] Scrolling down to the ConfigureServices function also in the Startup.cs:

[csharp] public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddWebApiConventions(); var options = readConfig(); services.AddSingleton(a => options); } [/csharp] In this method the first 2 lines are unchanged, but the last 2 add my GlobalVars to the DI list and initialize it with the options from my file. Now to see it in action inside a controller:

[csharp] [Activate] private GlobalVars _globalVars { get; set; } public IActionResult Index() { ViewBag.Title = _globalVars.SITE_NAME; return View(); } [/csharp] Notice how clean the access to the option is now simply using the new Activate attribute on top of the GlobalVars property. Something I'll be adding to this helper method going forward is type inference so the readConfig method would typecast to the type of the property in your arbitrary class.

Hopefully this helped someone out there in diving into the next version of ASP.NET, more to come for sure.

As some may have noticed, my site has undergone a slight revamp. Since going live with my ASP.NET MVC 4 based 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.

Along those same lines, my recent presentation at the Blue Ocean Competition on Xamarin Forms and C# in general made me turn a new leaf in regards to my side-projects. Starting a week or so ago, every day I've been checking in the complete source code to a project from my private Subversion repository I've kept for 8 years now. My thought process is that if 1 person finds even 1 thing they didn't know or could use, that's 1 more person who got use out of it than it simply sitting in my SVN repository until I went back around to work on it. As anyone whose followed my blog for any period of time knows I pick up a project, work on it for a while and then pick it back up a few months (or years) later.

That being said, in the coming weeks the platform that powers my blog, bbXP will also be made available on my Git Hub account. There's some work involved to get it to a more generic place along with cleaning up some of the code now that I've got another 2 years of MVC development under my belt.

Lastly, content wise I finally cleaned up my White Papers so everything is formatted properly now. I also began to fill in the gaps on the About Me page, still a lot of gaps in my development history that I want to document if only for myself.