Blazor, like most systems for generating Web pages, supports using layout pages for repeated content. Here's what works, what doesn't (yet) work and work-arounds I've discovered for what doesn't work.
The reality is that you will need to have, at least, two different configurations: one for production and one for development. Here's how to automate those conversions.
If you move beyond the basics of working with Razor Pages, there are at least two things you should know to support creating Pages that do more than one thing and integrate with existing code.
If you're moving your application's client-side code to Blazor, then you'll want Blazor to manage navigating between pages, too.
There are lots of ways to handle databases in a containerized environment like Docker. Here's how to create SQL Server in a container, how to load it with the data you want and how to integrate that container into whatever project needs it. Be warned: Some PowerShell is used.
Here's how to run a "real-world" application (consisting of an MVC application and a Web Service) in a networked set of Docker containers. And it's just a couple of mouse clicks in Visual Studio to implement it.
Our resident doctor of data science this month tackles anomaly detection, using code samples and screenshots to explain the process of finding rare items in a dataset, such as discovering fraudulent login events or fake news items.
- By James McCaffrey
- 03/04/2019
The Data Science doctor delves into supporting vector machines, software systems that can perform binary classification such as creating a model to predict the gender of a person based on their age, annual income, height and weight.
- By James McCaffrey
- 03/04/2019
If you want to handle the most common pattern in ASP.NET Controllers (displaying a page and then accepting data entered into it), you can do it with Razor Pages. You'll just need less code than if you used a Controller, a View and a model object.
As fond as he is of using Controllers and Views, Peter isn't sure that Razor Pages aren't a better model for Web development. But the first step, adding Razor Pages to your project, isn't as easy as it should be. And, after that, you'll want to integrate them with your existing MVC application.
In ASP.NET Core, your web.config file with its <appsettings> section is gone. The replacement is a more extensive and configurable system that you can leverage to simplify configuring your objects.
There are good reasons to keep working with Blazor 0.8.0.0 ... but you're going to need to make some changes.
ASP.NET Core's support for sharing objects defined at startup is great ... but what if you need to set options on those objects? Here's a case study that starts off great and then descends into over-engineered madness (but only if you want to go that far).
If you want to treat your database design as an "implementation detail" that just falls out of getting your object model right, then Entity Framework gives you four choices. Picking the right one, however, may mean creating your own.
ASP.NET Core makes building RESTful services easy and comfortable, says Joydip Kanjilal, who shows how to do just that in this article, complete with code samples and screenshots.
- By Joydip Kanjilal
- 02/05/2019
Eric Vogel uses code samples and screenshots to demonstrate how to create and use the views and controller for an ASP.NET MVC Core CRUD application.
Dr. James McCaffrey of Microsoft Research uses a full project code sample and screenshots to detail how to use Python to work with self-organizing maps (SOM), which let you investigate the structure of a set of data.
- By James McCaffrey
- 01/15/2019
Here's everything you need to write code for the Session object in ASP.NET Core -- including why you can't expect to migrate your existing ASP.NET MVC application to ASP.NET MVC Core (though Peter has some suggestions on easing that pain).
If you know how to create an ASP.NET MVC View, you know a great deal about how to create pages in Blazor. But, by packaging up pages as Blazor Components, you can use (and re-use) those pages more like objects.
Central to ASP.NET Core is the collection of objects that give you access to ASP.NET Core functionality. Here's how to access it, how to add to it and an example of how to use this technology with the "difficult" cases.
Templated components expose customizable sections via parameters, and consumers then pass in their own templates for these sections that the component will use when rendering. They make it really easy to create some high-level reusable components, especially when incorporating generics.
- By Chris Sainty
- 01/03/2019
Creating a custom image classification model is challenging, but the existence of neural network libraries like Keras has made it doable. Here's how, with many code samples and a full project download.
- By James McCaffrey
- 01/02/2019
By default, tests in the new .NET Core testing framework (xUnit) are isolated. This is a good thing ... except when you need to create a single test environment that is used by multiple tests. Here's all the ways you can provide a single environment for a set of tests in xUnit.
There's a new testing framework in town. Here's how to use it.
Sometimes the easiest solution isn't the best one. Here's an architectural approach to building Blazor pages that also makes it easy to combine the worlds of JavaScript and Blazor.