This week’s weather has been overcast and cloudy, and this morning the forecast looks like the image above (according to an online weather source). So I thought I’d share a few things I worked through yesterday and this morning to get some rain out my cloud.
Here’s what the solution is using, so far:
MVC 4 Internet project – and all the scaffolding bits it gives us. Nuget packages only include Unity.Mvc4 & Microsoft.ServiceBus right now. I’ve got some ideas for logging that’ll use some of the PnP Enterprise Library goodness to wire-up some business and system logging for this solution, as well as tap into Wasabi for scaling & throttling ideas I have for the solution – more on the last two later on though.
The solution is pretty simple, and that’s how I’d like to keep it for now. But I needed to start pulling some mock data into grids to start with, and historically being a server-side coder I started out trying to unload my collections with some of the HTML helpers Razor exposes to us. But it really just didn’t feel right and I found myself trying to hack something together to get some data into the view. The night before I was having a conversation with John Papa around UI/UX content enablers. He makes all of this stuff look so easy, so I thought, sure I can do this too so I set out to jam in a JQuery plug-in to spin through my data.
I settled on jqGrid with only a few minutes of looking around the jQuery home page. So not being the client-side junkie most folks are these days I started Binging for code samples. After a few hours (seriously, I’m not that smart and somethings take longer than it should) I found a post on Haack’s site that talked about what conventions need to match and which ones don’t. Oh, and after a minutes I fixed the signature on my controller action and the code started lighting up. Now it’s only formatting I need for a few views which I won’t burn too many cycles on.
Using Phil Haack’s example, I had jqGrid running in a few minutes. But I will say this – I did learn alot about the Html Helpers ASP offers, they are powerful and very handy.
The side of effect of this choice was larger than I thought though and required a bit of refactoring. The view receiving this data was strongly-typed with IEnumerable and now that the data was coming from a jqGrid call to an action that returned a JSON payload, I didn’t need that. The repository method that was serving the data to the controller looked funny now. I needed to scope the method to just return the requestor’s data, not all of the data. I may still split this interface up because of ISP, but I’ll keep my eyes open for code smells just in case.
So, there’s a bit of refactoring going on today before I hookup the Azure persistence piece which is next. I haven’t quite figured that out yet, but soon. The easy part about this is I can still target my Azure Service Bus queues, and tap into the local storage emulator on my local box until I figure out data and or document shapes for the storage thingee.
Here’s a gist with the view and controller source.
HTH /oFc
You must be logged in to post a comment.