X

Why to avoid fat controllers

Although ASP.NET MVC has been here for years the discussion about fat and thin controllers continues. There are guys who have strong faith in fat controllers and guys who believe more in thin controllers. Having seen both types of controllers I wrote this post to share my experiences with you.

Either ErrorMessageString or ErrorMessageResourceName must be set, but not both

Found weird error when adding translations support to some ASP.NET MVC models. I’m working on application that uses authentication forms generated by Visual Studio. As it turns out this is known bug with data annotations in .NET 4.5. Solution is here.

Null propagating operator in C#

C# 6.0 introduces language feature called null propagation. It’s about avoiding all this if-else mess in most sanity checks that avoid NullReferenceException.Of course, null checks can be found also from other parts of code that doesn’t necessarily deal with sanity checks. Let’s see how new null propagation feature help us write cleaner code.

ASP.NET 5: Using POCO controllers

ASP.NET 5 supports POCO controllers. Yes, controller classes that doesn’t extend Controller base class. These controllers look a little bit different by some small aspects and sometimes we may need to help framework detect our POCO controllers. This posting gives you complete overview of POCO controllers in next ASP.NET.

C#: Expression-bodied members

New C# introduces expression-bodied members of classes. Instead of property or method that makes some simple calculation we can define expressions and keep our code shorter. Nice thing is – also other .NET languages are able to use these new members. Let’s see what we can do with expression-bodied members in C#.

ASP.NET 5: Using shared sources

ASP.NET 5 supports code sharing between projects. It’s not about referencing libraries or something related to portable libraries – it’s different. Libraries can share their source that is compiled to referencing project output. In this posting I will show you how this new source sharing system works.

ASP.NET 5: How to debug with ASP.NET source?

Although ASP.NET MVC is well tested framework and probably you don’t find any major bugs in public releases you may still sometimes need to debug your application with ASP.NET MVC sources. In this posting I will show you how debugging with sources works in ASP.NET vNext.

ASP.NET 5: New configuration files and containers

With ASP.NET vNext we get also new config files. Yes, files, because more than one config file format is supported. Our configuration can be JSON, INI or XML and I’m sure you can write configuration handlers that support your own custom formats. Also support for multiple configuration containers is here. In this posting I will show how new configuration system works in ASP.NET vNext.

Auto-property initializers in C#

Automatic properties is good feature in C# as we don’t have to declare variables for property values in our code. Instead we move this responsibility to compiler that automatically generated hidden backing field for property. New C# solves another problem – assigning default values to automatic properties.

ASP.NET 5: New structure of solutions and projects

ASP.NET MVC 6 solutions have a little bit different solution and project structure. Changes are needed because of new minimalistic tooling and cross-platform requirements. This posting gives you overview of new solution structure and explains how solutions will be organized in future.