Programming

Things the are Programmed

  • Starting with SQL Console app

    Starting using VS 2017 console app:  A site to look at: https://ef.readthedocs.io/en/staging/platforms/full-dotnet/existing-db.html In console app… using the Package Manager Install-Package Microsoft.EntityFrameworkCore.SqlServer Install-Package Microsoft.EntityFrameworkCore.Tools Install-Package Microsoft.EntityFrameworkCore.SqlServer.Design Database 1st – Scaffold it… Scaffold-DbContext "Server=Orion;Database=ScottDB;Integrated Security=False; User ID=sa;Password=****" Microsoft.EntityFrameworkCore.SqlServer **Note nvarchar types have issues in the Entity definition, and regardless what the “InterTubes” say- .HasColumnType and .HasColumnSize – does NOT work. Sample Connect string Data Source=ORION;Initial Catalog=ScottDB;Integrated Security=False; User ID=sa;Password=********;Connect Timeout=30;Encrypt=False; TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False Don’t forget Migrations. These can still be useful to keep your code and DB in sync. Add-Migration InitialMigration Update-Database [[-Migration] MigrationName]