X

ASP.NET

Using xUnit with ASP.NET Core

Writing tests for ASP.NET Core applications can be done using xUnit. xUnit works on both.NET Framework and .NET Core. This post shows how to set up and use xUnit with ASP.NET Core applications in Visual Studio and on command-line. Targeting multiple frameworks is also covered.

ASP.NET MVC: Precompiling views

This blog post is about how to really precompile ASP.NET MVC views. It destroys the myth about MvcBuildViews as precompilation tool and shows you how to configure precompiling. It also stops on some internals of precompiling and explains what are the options and limitations with it. There is also real-life example for Azure where precompiling of views may avoid some serious headaches that one may face otherwise.

Using dependency injection with view components

On ASP.NET Core view components support dependency injection. We can use some DI/IoC container but we can also go with framework level dependency injection. This blog post explains how dependency injection works with view components and as an example I show you some code I’m using to build top menu for my demo site.

Building pager view component

Whenever we deal with data we need some mechanism for paging it. It makes it easier for users to navigate through data and same time we don’t put too much load to our systems. This blog post shows you how to build pager for your MVC site using ViewComponent and PagedResult class.

ASP.NET Core dependency injection

ASASP.NET Core has dependcy injection available at framework level and ASP.NET Core is heavy user of it. Most of things surrounding controllers, views and other MVC components are implemented as services that web applications consume. This post is intensive overview of dependency injection in ASP.NET Core.

ASP.NET 5 and CSS bundling: Fixing image paths

With ASP.NET 5 we don’t have current bundling and minification system available. It’s replaced by new one that is based on Gulp. Default web application shows how to minify simple and safe files. But if you have some more complex design with CSS files referring to images then you are on your own. This post shows you how to solve a problem.

What is ASP.NET console application?

One mystery in ASP.NET 5 that people are asking me about are ASP.NET 5 console applications. We have web applications running on some web server – what is the point of new type of command-line applications that refer by name to web framework? Here’s my explanation.

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.

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.