Posted by beolson on April 26, 2009
I have always ran my own subversion server for managing my source code for my personal projects. However, I am looking at updating my server, and I was not really looking forward to re-installing the package again. In addition to that you have the backing up and maintaining to worry about. So, I spent some time looking into managed hosting for source code management.
Team Foundation server – http://www.phase2.com/hosted_team_foundation_server_overview2.aspx?gclid=CNfc7raLkJoCFQHyDAodlCslGg – $129 per user per month!!!!
Codespaces – http://www.codespaces.com/shop – Ranging from free (2 users) to ($60) for unlimited users and unlimited projects. Uses subversion for the source management, and custom software for its project management.
I have played with Team Foundation Server a fair amount, and spent a couple hours working with Codespaces now. Here is my quick review
Team Foundation Server – Integrates real well into Visual Studio. Higher learning curve – it will take time to master team foundation server. Also comes with Build automation and code quality checks.
Codespaces – Web based – no native integration with Visual Studio for the project management, but does come with an API. Subversion does integrate into Visual Studio though. Simple to learn and use. Does not have build automation or code quality checks (but there are other free products that do that). I don’t think it comes with the level of reporting that TFS comes with, but I bet you could use the API to generate those same reports if you needed to.
I signed up for the 45 day trial of Codespaces, but I think I will be signing up for the $9 plan at the end of the trial.
Quick update – I ended up dropping Codespaces. Nothing wrong with them, I just found a different provider that fit me better. I have been using Assembla for about 4 months now and have been enjoying it.
Posted by beolson on April 19, 2009
Two things I find my self doing often in my web applications is returning paged data and returning xml/json using the same logic I use to return html pages. So, with that in mind I have 2 classes that I use a lot.
PagedData –
I love generics. They take a bit of time to get use to using, but once you start using them you realize their simple power.
Generics can act as a wild card in a class. The when you use generics you can essentially pass any other class type into the class. In the example below, if we create in instance of the PagedData class using a string data type, we will create a new list of strings. If we create it with a custom class type we can keep a list of that class type.
Using this we can construct a container class for storing paged data of any data type. In a paged data scenario the following types of information are needed –
- Total Number of Pages
- Page Size
- Page Count
- Total Number of Records
By adding these int data types of our PagedData class we can create a class that neatly wraps up all our paging data needs.
We can then use this in our code like so:
DynamicResult –
The other class I include in the DynamicResult class that I have blogged about earlier. This has been a major help, and allows us to turn the ASP.NET MVC toolkit into a very powerful REST Toolkit.
Both of these classes are extremely simple – but their power lies in that simplicity. Both of these classes can be found in the attached zip file along with a simple demo project that uses both of them.
MVCExtensions.zip
Posted by beolson on March 3, 2009
One of the things I find myself doing when developing applications with ASP.NET MVC is creating multiple result formats depending on what my situation is. So, for example, I may need to return a list of items in an HTML page, or I may need to return the same list in JSON format.
An example, would be if I create a ActionResult that returns a large dataset. I would normally return the first page using HTML, and subsequent pages using AJAX. Using this pattern, I often found myself using the following code in my ActionResults:
Not that bad – Not much code there. But after writing this for just a handful of results, I found myself looking for a better way to do it. The key to what I wanted to do was in creating my own ActionResult.
The solution is simple, and allows me to use code like the following in my ActionResults in my Controllers:
When using this, the DynamicResult will check the querystring for “json=true”, and it will check the request header for “json”. If either one evaluates as true, then it will return the result in json being returned. If not, it will render the result using the default View page. Note, this solution does not give you the flexibility to pass in a view page outside of the normal view page convention.