Get Table and Columns Name of mapped entity in Entity Framework Core

var context = new BiContext();

var entityType = context.Model.FindEntityType(typeof(InvoiceDetail));

var tableName = entityType.GetTableName();
Console.WriteLine(tableName);
var properties = entityType.GetProperties();

# Property Name in Class
foreach (var p in properties)
{
    Console.WriteLine(p.Name);
}

# Column Name in Table
foreach (var p in properties)
{
    Console.WriteLine(p.GetColumnName());
}

References
https://stackoverflow.com/questions/45667126/how-to-get-table-name-of-mapped-entity-in-entity-framework-core

Install .NET 7 on Ubuntu using Snap

sudo snap install dotnet-sdk --classic --channel=7.0
sudo snap alias dotnet-sdk.dotnet dotnet

You can edit your shell profile to permanently add the commands.

Bash Shell: ~/.bash_profile, ~/.bashrc

export DOTNET_ROOT=/snap/dotnet-sdk/current

References
https://learn.microsoft.com/en-us/dotnet/core/install/linux-snap
https://stackoverflow.com/questions/68519558/how-to-fix-segmentation-fault-core-dumped-when-creating-new-dotnet-project

Read characters from a string in C#

using System;
using System.IO;

public class CharsFromStr
{
    public static void Main()
    {
        string str = "Some number of characters";
        char[] b = new char[str.Length];

        using (StringReader sr = new StringReader(str))
        {
            // Read 13 characters from the string into the array.
            sr.Read(b, 0, 13);
            Console.WriteLine(b);

            // Read the rest of the string starting at the current string position.
            // Put in the array starting at the 6th array member.
            sr.Read(b, 5, str.Length - 13);
            Console.WriteLine(b);
        }
    }
}
// The example has the following output:
//
// Some number o
// Some f characters

References
https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-read-characters-from-a-string

Allow GUI root login on Ubuntu 22.04

sudo passwd
sudo nano /etc/gdm3/custom.conf

Inside the GDM configuration file, we need to add the AllowRoot=true line. After you have made this change, you can save and exit the file.

AllowRoot=true
sudo nano /etc/pam.d/gdm-password

Inside of the PAM authentication daemon file, comment out the following line, which denies root access to the graphical user interface, with a pound sign #. You can save your changes and exit this file when done.

auth   required        pam_succeed_if.so user != root quiet_success
reboot

References
https://linuxconfig.org/how-to-allow-gui-root-login-on-ubuntu-22-04-jammy-jellyfish-linux