learning Java Spring

TODO: MODIFY THIS SO IT HAS THE SAME STRUCTURE AS Learning .Net BUT THE CONTENTS FOR SPRING

overview

.net is a dev platform, a collection of languages and libraries for building software.
.Net is a framework / ecosystem to build cross platform apps.
You can write code in C#, F#, VB and powershells under the .net framework
These get compiled to the same Intermediate Language (IL, dll files) and get executed by the common runtime. This makes it platform independent.

Platforms are the things you build software FOR:
.Net core: windows macos, linux
.net framework: web sites, services and apps on Windows
Xamarin/Mono: .net for mobile

Base class library(BCL) set of functions with basic necessities covered. Like Httpclient, Threading.Task...

Can build any app with .net: web, cli, mobile, games (unity)

Blazor is the web framework
loook more up on this and rewrite it better.
blazor assembly is for building front end client apps with html, css and c#. uses web assembly to translate operations to machine code. therefore soporta todas las plataformas.

hello world

Download dotnet from the site

With the 'dotnet' CLI create a project.
Commands
new
run
dotnet run environment=development runs in 'development' mode, if error occurs it returns the stack trace and all debug info to client.

Dotnet hello world tutorial
Dotnet docs

Tooling

Libs

AspNetCore
Controllers
Model Binding
Sources

By default, model binding gets data in the form of key-value pairs from the following sources in an HTTP request:

  1. Form fields
  2. The request body (For controllers that have the [ApiController] attribute.)
  3. Route data
  4. Query string parameters
  5. Uploaded files

ORM

Entity Framework (ef)
install tool globally with dotnet tool install -g dotnet-ef

Code first approach

  1. create entity C# classes
  2. create migration dotnet ef migrations add InitialCreate
  3. run migration dotnet ef database update

Database First approach

generating Entity classes and DbContext classes from an existing database schema.
there are a few ways to do this

Scaffolding commands

Or I can run scaffolding commands
guide 1
guide 2(they basically show the same thing)

dotnet CLI command (in regular shell):

Scaffold-DbContext "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Test_Invoice;Integrated Security=True" Microsoft.EntityFrameWorkCore.SqlServer --output-dir Models --context TestInvoiceDbContext --context-dir Data --data-annotations --force

(localdb)\MSSQLLocalDB seems special syntax for LocalDB instances.
I can add the -f flag at the end of the command to force scaffolding to overwrite existing model files.

once the classes are created we can then / have to connect and manipulate our existing database. add / modify the DbContext to include the new generated classes

I can even generate the Db Context class.
https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/database-first-development/generating-views

You can then even generate the Controllers and Views automagically !!!!!
https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/database-first-development/generating-views

HTML templater

Razor (.cshtml, .razor files)


project structure

appsettings.json has ConnectionString for database
bundleconfig.json:
Program.cs: entry point, where server and services get started
Startup.cs:
Properties/launchSettings.json:
src/