.NET Core - MVC

Observations about .NET Core, MVC and converting YetaWF from ASP.NET MVC5 to .NET Core MVC. The new .NET Core has great new features. Getting there from an existing MVC 5 app is HARD!

YetaWF Blog

Showing blog entries published on or before 05/30/2017.

Support Dropped For ASP.NET Core MVC

05/10/2017
 

Update: This post is no longer relevant as YetaWF supports ASP.NET Core 2.0 since YetaWF version 3.0.0.

Update: A few hours later, it was announced that ASP.NET Core 2.0 will support netstandard2.0. All is well. As soon as ASP.NET Core preview is updated for netstandard2.0, we will resume support for ASP.NET Core.

Update (7/5/2017): Unfortunately ASP.NET Core 2.0 Preview 2 is still unusable, mainly because of Visual Studio 2017 ...

2017 So Far Has Been Wasted On ASP.NET Core MVC

05/09/2017
 

In January 2017 I decided it was time to "upgrade" YetaWF from MVC 5 to the new ASP.NET Core MVC. Oh, and how much fun it was (Not!). I spent about 2 months converting silly (and major) things which changed between MVC 5 and ASP.NET Core (see Incompatibilities Galore). So, after two months I had a working, deployable version of YetaWF. Was it any better than the vers ...

VarChar or NVarChar Is Never The Question

05/07/2017
 

So, if you had asked me yesterday whether YetaWF data is stored as UNICODE in SQL tables, I would have said "Of Course!". Since YetaWF supports localization, we have to.

Well, assumptions are a death sentence for any developer. But how could I be wrong? I wrote all of YetaWF (well, except for all the add-ins, courtesy of the open source community). I "meant" for data to be stored in UNICODE. And it seem ...

There's Something Wrong With MVC Views

05/01/2017
 

For years I have always felt there is something wrong with MVC (Razor) views. (Warning: Another grumpy old man post...)

Precompiled views? That's really funny. How about "precompiled" .cs files? Well, we have those. That's what happens when you compile/build your web project. It creates assemblies which can then be deployed to your production server. And, the compiler is clever! It knows that a file hasn't been changed and doesn't need to be recompiled. Tha ...

Yay, Visual Studio 2017. NOT!

03/20/2017
 

Warning: This is a negative writeup about web development with Visual Studio 2017 ... (some comments are PG+).

I actually have to (and try to) get work done. Visual Studio 2017 is a letdown in so many ways that I hate using it.

All of my comments apply to web development with Visual Studio 2017 and ASP.NET Core. I have no issues with C++ and C# Windows Forms (etc.) development. And mind you, I have been using VS2015, 13, 10 for similar web development, often the same ...

Incompatibilities Galore

03/11/2017
 

When we set out to upgrade YetaWF to ASP.NET Core, we envisioned dual support for ASP.NET 4 MVC 5 and ASP.NET Core MVC using the same code base but embracing the new ASP.NET Core and making YetaWF fill in the gaps on ASP.NET 4. Mission accomplished! While all modules and skins are virtually 100% source code compatible (with a few strategic #if MVC6), the framework code (mostly the Core package) was not so lucky. Still, it's the same code base and we plan on supporting both ASP ...

<input> Tag Ids... Really?

02/28/2017
 

ASP.NET Core MVC 1.1 has another unexpected "gift" in store. It will decorate all tags with id=property which is utterly unexpected (compared to MVC5) and utterly unnecessary. If your EditorFor(), DisplayFor(), Hidden() etc. statements don't supply an id, one is generated for you, based on the property name. But WHY? If my code doesn't ask for it, does my code really want an id?

What makes this completely untolerable is the fact that for W3C compliance no ...

Project Names and NuGet Package Names

02/23/2017
 

This is no longer applicable as Visual Studio returned to using *.csproj files and project.json is no longer used.

The YetaWF solution consists of a lot of projects (500+, many of which are non open source), and includes a fair number of third-party components. While converting to MVC6, I experienced an odd error message:

Cycle detected: YetaWF2 (>= 1.0.0) -> Twil ...

Custom Razor Views cannot inherit RazorPage<T>

02/23/2017
 

This was almost a showstopper.

Our views would not compile with ASP.NET Core MVC. Every single one got this error:

Property 'ViewData' is of type 'Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1[[YetaWF.Modules.Text.Controllers.TextModuleController+TextModelDisplay, YetaWF.Text, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null]]', but this method requires a value of type 'Microsoft.AspNetCore.Mvc.ViewFeatures ...

AdditionalMetadataAttribute Anyone?

02/15/2017
 

If you developed any non-trivial MVC3-5 application, you may have used the AdditionalMetadataAttribute. YetaWF uses the AdditionalMetadata attribute to "decorate" properties for its scaffolding support. For example, when using a Url, the property is defined similar to this:

[Caption("Url"), Description("Url")] [UIHint("Url"), AdditionalMetadata("UrlType" ...

Compatibility Be Damned!

02/13/2017
 

After working with ASP.NET Core MVC I have a few opinions about it. Do I like it? Yes. But, while it looks like a solid new release, with some nice new features, I can't shake the feeling that this was developed by some very smart people with absolutely no experience in the business (real) world and marginal experience with large MVC applications or maybe just a superficial knowledge of MVC5. Or maybe they just didn't care about compatibility. There are so many changes which make ...

TagBuilder ToString()

02/07/2017
 

YetaWF has a fair number of templates which are used with the UIHint attribute - And a lot of code generating the required HTML for the templates. In MVC5, the TagBuilder class was used to build HTML tags. Once all tag attributes are set, the ToString() method was used to generate the tag HTML string. Unfortunately, the TagBuilder.ToString() method in ASP.NET Core MVC is not implemented, so the object.ToString() method is used instead. This of course doe ...

TagBuilder.InnerHtml

02/07/2017
 

If you're using TagBuilder extensively in any MVC5 project, you'll eventually use SetInnerText and InnerHtml.

These always felt a bit awkward to use. ASP.NET Core MVC fixes that, but with another somewhat odd InnerHtml property which uses IHtmlContentBuilder. This collects encoded and unencoded strings and renders the entire contents using WriteTo.