Blog: 2015 March

ASP.NET MVC: How to implement an edit form for an entity with a sortable child collection

March 30, 2015, (updated on June 10, 2015), 22 comments, Software Development

This article shows how to implement the edit form for an entity with a collection property. As a show case, we will implement the edit form for a person entity with multiple addresses. The following diagram shows the UML diagram of the two entity classes: The final edit form for a person entity should look like this: The goal is to implement this form so that the address items are sortable and validated directly on the page. The article describes how to implement the described edit form in a simple way with as little as possible lines of code. The […] Read more...

Tags: , , , ,

My most used Visual Studio and ReSharper extensions

March 12, 2015, (updated on August 25, 2015), 5 comments, Software Development

This article describes some of the Visual Studio and ReSharper extensions and development tools I’m using to enhance my daily C#/.NET development productivity. ReSharper extensions In my opinion, ReSharper is a must have extension for Visual Studio which provides lots of improvements, for example better refactorings, an improved code snippet and template engine, additional static code analysis and much more. My personal configuration: Use camel humps instead of whole word when navigating or deleting: ReSharper > Options… > Environment > Editor > Editor behavior > Use CamelHumps Copy XML documentation from interface when generating interface methods: ReSharper > Options… > […] Read more...

Tags: , , , , , ,

Cheat Sheet: Best practices for writing XML documentation phrases in C#

March 11, 2015, (updated on September 16, 2015), 3 comments, Software Development

The XML documentation tags of C# are described very well in the MSDN. However, the article does not explain how the contained phrases and sentences should be written. This article tries to fill this gap by providing rules and some sample phrases. I recommend using StyleCop because its rules enforce some of the XML documentation recommendations from this article. Also check out the Visual Studio extension GhostDoc which automates and simplifies the writing of XML documentation. General All XML documentation phrases should end with a period (.) and no blank: <summary>Represents an XML document.</summary> public class XDocument { The summary […] Read more...

Tags: , , , , , ,

How to implement and register a custom dependency resolver in ASP.NET MVC 5

March 6, 2015, (updated on March 26, 2015), Software Development

The ASP.NET MVC 5 framework supports the integration of 3rd party dependency injection frameworks. This can be done by implementing the IDependencyResolver interface and registering an instance of the interface on application startup. The registration is made in the Application_Start method which can be found in the Global.asax.cs file: protected void Application_Start() { ... var compositionContext = new CompositionContext(); compositionContext.AddPart<IMyService, MyServiceImpl>(); // TODO: Register your own services here DependencyResolver.SetResolver(new MyDependencyResolver(compositionContext)); } Most dependency injection frameworks provide a NuGet package which already contains an IDependencyResolver implementation (for example Ninject.MVC3). However, because I wanted to use the IoC container from my own […] Read more...

Tags: , , , , , , ,


  Page 1 of 1