How to pass and read query parameters from one page of your application to another by using the React Router

In this post we are going to see how you can register a new route in your React application and then pass information with the help of query parameters from one subpage to another.

Let us suppose the following scenario. You have page that contains a list of products with some basic information. You want to be able to click on an item of this list and navigate to a details-page, where the user can find more details about a specific product.

The following code examples are written in TypeScript. Visual Studio provides a great starting template for your React projects. I used the 4th generation of the React Router

First we need two routes for the scenario we just mentioned. The first route loads all the products, with only a limited information for each of them, from our backend and the second one loads the all the details to one product:

Read the complete article

The reason behind the identifier could not be resolved error in your CosmosDB queries

When writing SQL queries to test them against your CosmosDB collections, chances are that your deal with the following error message:

Identifier XXX could not be resolved.

where XXX is the name of a property inside your collection. You could have for example the following query:

SELECT * FROM students WHERE firstname = 'Christos'

The reason for the error is that you forgot something in your query.

Read the complete article

Manage configuration in your .NET Core web projects by using the IOptions interface

Every application out there needs to read some configuration written from the programmers in order to perform critical tasks and function correctly. Examples of configuration can be the connection string to your SQL database or a boolean flag which decides if a feature will be available to your customers or not.

.NET Core gives us a way to store our configuration in a json file and access its properties programmatically.

This way of coding gives us the advantage of not having to redeploy our application, every time we update a value in our configuration (in our case the json file). We simply have to recycle the application pool that hosts our application and we are set.

Read the complete article

How to solve the "project.assets.json not found. Run a NuGet package restore to generate this file" problem in .NET Core applications when using MSBuild

While I was developing a .NET Core web application and wanted to automate the build process in VSTS, I got the following error, when I was triggering the build:

Error: Assets file ...\project.assets.json not found. Run a NuGet package restore to generate this file. Process 'msbuild.exe' exited with code 1.

The issue here is that needed .NET Core files are missing, when we start build our application. I solved this problem by defined an extra initial step in my build process.

Read the complete article

Write a custom .NET attribute to mark searchable columns of a HTML table and match them with their equivalent DB columns

Consider you have to implement the following requirement:

  • We have a MVC .NET web application and a view with a HTML table and multiple columns. We want to mark some of these columns as searchable, so that we can search their values when we use the search field.

  • We host our data in a relational database, we get the structure of the DB table as it is. We use Entity Framework and we need to “map” the DB columns to their equivalent UI columns, so that the search works correctly.

Here a simple mockup of our UI:

Read the complete article