.NET Core

.NET (previously named .NET Core) is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems. It is a cross-platform successor to .NET Framework. The project is primarily developed by Microsoft employees by way of the .NET Foundation, and released under the MIT License.


Blazor

A Blazor app is composed of reusable web UI components built using C#, HTML and CSS. By using Blazor, developers can build client and server code with C#. Developers can also share code and libraries between front- and backend logic. By using C# for all code the sharing of code between developers gets simplified, is easier to reuse to accelerate the development and maintenance.

By using Blazor, you can generate:

  • Server-side code that handles UI interactions over a WebSocet connection.
  • A Client-side web app that runs directe in the browser via WebAssembly.

CSS

CSS or Cascading Style Sheets is a style sheet language used to define visual appearance and formatting of HTML documents. WordPress themes use CSS and HTML to output the data generated by WordPress. Every WordPress theme contains a style.css file which has style rules to define the formatting of pages generated by WordPress.


Query

A Query is a term developers are using to describe the act of selecting, inserting, deleting, or updating data in a database also known as CRUD operations. In programming, queries are used to access data from various databases. When talking WordPress the most used databases are MySQL and Postgres and when talking C# the most used is MS SQL.

Each time you are viewing a webpage on the internet there are for sure queries running in the background to fetch or post data to and from the database. This data is used to generate dynamic HTML pages in your browser. When a user in a control panel is creating, deleting or editing content, there are underlying database queries that convert the user's input to instructions which are then executed by running these so-called database queries.

Queries With WordPress

WordPress has built-in functionality and classes that gives the developer access to implement functionality for the user to query the database. Below is a short list of some examples:

  • WP_Query
  • WP_User_Query
  • get_comments()
  • get_the_terms()
  • get_posts()
  • wp_get_recent_posts()

Below is a very short code-snippet of how you can query the database for posts within a category using the WP_Query class in WordPress.

$posts_query = new WP_Query('cat=32');

The returned data is a set of posts within a specific category. These can now be displayed in the front-end using a template. As a WordPress developer, you can also query the database directly by calling the $wpdb class.

function my_custom_wordpress_query() {
global $wpdb;
$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );
echo "<p>The user count is {$user_count}</p>";
}

A query can also be used to insert new data into a database (this could be when you are creating a new post, uploading a picture etc...) or when editing existing content. This is automatically handled by WordPress, but developers making new extensions (plugins) can also use this to store information from their own data into the WordPress database.

global $wpdb;
$wpdb->query( 
    $wpdb->prepare( 
        "
                DELETE FROM $wpdb->postmeta
         WHERE post_id = %d
         AND meta_key = %s
        ",
            13, 'stars'
        )
);

In WordPress, a query is capable of retrieving (by default) items based on tags, categories, status, title, etc... As a developer, you can use this to create your own widgets or custom pages to display specific content for the users.

Queries With C# / .Net Core

The application does not care about the type and structure of the original data source (it's not important). The application will always see the source data as an IEnumerable<T> or IQueryable<T> collection. If you are using LINQ to XML, then your source data will be made visible as anIEnumerable<XElement>.

Below is a code snippet to retrieve a subset of elements to produce a sequence without modifying the individual elements retrieved by the query. Inside the query you are able to sort or group the returned sequence in different ways as you can see below. Please assume that scores is an array of integers (int[])

IEnumerable<int> highScoresQuery =
    from score in scores
    where score > 80
    orderby score descending
    select score;

If you would like to know more about Query Expressions please take a look at the official Microsoft Documentation about Query Expression Basics.


WebAssembly

WebAssembly (WASM) is an open binary standard. It is a standard for defining a portable code format for programs developed to run in browsers (web). WebAssembly is a textual language with a compact binary format. This gives fast download speed and near-native performance at run-time.

WebAssembly provides a compilation target for languages such as C, C++, etc... It is from the ground designer o be running alongside a language like JavaScript - so both are capable of working together. A WebAssembly can also be used to generate a progressive web application that can be downloaded and run offline.