mezcel / sharp-structs

Csharp console application which converts csv to struct to perform ER queries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sharp-structs

A Csharp console application which converts *.csv data into structs to perform ER queries.

Motivation/Background:

  • History: Way back before Win10 I made an social C# rosary app which depended heavily on ADO, a WPF GUI, and multiple networked client computers united by a networked host server.

  • Revisit: In 2021, I revisited the project and made a minimal single user stanalone TTY version.

    • Exercise objective: Instead of ADO/MySql, Tables, and Dictionaries... I just just use a Class/Struct ER database populated with *.csv data. The *.csv files are taken from printf-time.git
    • Having not touched C# in a while, this was a refresher review project.

Initialize and run this .NET Project

Debian

## rm previous builds and initialize with *.txt script *.cs
## .NET for Debian will also be installed if needed
## https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian

./dotnet-new-console-debian.sh

## Run project

dotnet run

Win10

:: rem previous builds and initialize with *.txt script *.cs

.\dotnet-new-console-win10.bat

:: Run project

dotnet run

Development

Default Assumptions

CSV

  • *.csv files are ; delineated instead of ,
  • Csv header format ERClassName.ERClassAttribute
    • Example:
      "bead.beadID";"bead.beadType"
      0;"my bead type string"
      

Database

Assumes CSV files are stored in .\database\csv\*.csv

  • Change MyFunctions.CsvFilePath( csvBaseName ) instructions or omit it's usage to import an external ER class.
    • Manual definition example:
      // base file name
      string csvBaseName = "myCsvFile.csv";
      ERClass.Bead.csvBaseName = csvBaseName;
      
      // Default
      string path = MyFunctions.CsvFilePath( csvBaseName ); // @".\database\csv\myCsvFile.csv"
      ERClass.Bead.path = path;
      
      // Alternate (N/A)
      string path = @"C:\database\myCsvFile.csv"; // Custom path location
      ERClass.Bead.path = path;

Dependencies (Debian)

Guidance: Install the .NET SDK or the .NET Runtime on Debian

## DL *.deb

wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

## install .Net

sudo dpkg -i packages-microsoft-prod.deb

sudo apt-get update; \
	  sudo apt-get install -y apt-transport-https && \
	  sudo apt-get update && \
	  sudo apt-get install -y dotnet-sdk-5.0

sudo apt-get update; \
    sudo apt-get install -y apt-transport-https && \
    sudo apt-get update && \
    sudo apt-get install -y dotnet-runtime-5.0

Dependencies (Win10)

.NET 5.0 (recommended)

.NET is a free, cross-platform, open-source developer platform for building many different types of applications.

.NET 5.0 (recommended) x64 .NET 5.0 (recommended) x86
dotnet-sdk-5.0.202-win-x64.exe dotnet-sdk-5.0.202-win-x86.exe
windowsdesktop-runtime-5.0.5-win-x64.exe windowsdesktop-runtime-5.0.5-win-x86.exe

.NET Core 3.1 (LTS)

.NET Core is a free, cross-platform, open-source developer platform for building many different types of applications.

.NET Core 3.1 (LTS) x64 .NET Core 3.1 (LTS) x86
dotnet-sdk-3.1.408-win-x64.exe dotnet-sdk-3.1.408-win-x86.exe
windowsdesktop-runtime-3.1.14-win-x64.exe windowsdesktop-runtime-3.1.14-win-x86.exe

Export as a packaged executable

## build and package within the project home directory
dotnet publish --output "./" --runtime win-x64 --configuration Release -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true

VSCode Plugin

## https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp

code --list-extensions
code --install-extension ms-dotnettools.csharp
#code --uninstall-extension ms-dotnettools.csharp

About

Csharp console application which converts csv to struct to perform ER queries.


Languages

Language:C# 87.7%Language:Shell 11.6%Language:Batchfile 0.7%