2022 latest updated solution is this link tool link
Scaffold-DbContext "Server=PSPL-HYD-LAP07\PSPLHYD;Database=SMITANGA;User ID=sa;Password=123456789;Trusted_Connection=false;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models.
server link
Scaffold-DbContext -Connection "Server=SQL8002.site4now.net;Database=db_a88748_tmsnew;User ID=db_a88748_tmsnew_admin;Password=09r11a0222;TrustServerCertificate=true;"-Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -context db_a8638c_tmsContext -force
update model use(Becarefull old model will lose)
Scaffold-DbContext -Connection "Server=PSPL-HYD-LAP07\PSPLHYD;Database=SMITANGA;User ID=sa;Password=123456789;Trusted_Connection=false;"-Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -context SMITANGAContext -force
to update model context again
Scaffold-DbContext -Connection "Server=(local);Database=DefenderRRCart;Integrated Security=True;Trusted_Connection=True;" -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir RRStoreContext.Models -context RRStoreContext -Project RR.DataAccess -force
Scaffold-DbContext -Connection "Server=SQL8003.site4now.net;Database=db_a8638c_tms;User ID=db_a8638c_tms_admin;Password=09r11a0222;Integrated Security=True;Trusted_Connection=false;" -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -context SMITANGAContext -force
use this
install this first
1. Microsoft.EntityFrameworkCore.SqlServer
2.Microsoft.EntityFrameworkCore.Tools
for .net6 Updated connection string:
Scaffold-DbContext "Server=PSPL-HYD-LAP07\PSPLHYD;Database=MYFASHO;User ID=sa;Password=123456789;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
services.AddDbContext<DB_9F30C5_FMSContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("FMSWebApiTestContext")));
services.AddCors(options =>
{
options.AddDefaultPolicy(
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
//.AllowCredentials()
);
});
https://stackoverflow.com/questions/41233300/update-entity-class-in-asp-net-core-entity-framework
trusted connection true to false if get error security
No comments:
Post a Comment