.net core API 8 publish cpde to Azure
By default Azure deoloyes code to common default location "C:\home\site\wwwroot"(you can find on Kudu) but here need to deploy in ISOATSAPI folder, so we need to create virtual directory on Azure from
Welcome to .Net World of Srinivas & Sriharsha Kalagara, USA
.net core API 8 publish cpde to Azure
By default Azure deoloyes code to common default location "C:\home\site\wwwroot"(you can find on Kudu) but here need to deploy in ISOATSAPI folder, so we need to create virtual directory on Azure from
Angular Deploy
To build the code
ng serve
To build the code to some specific Context folder ISOATSUI
ng build --configuration=test --base-href "/ISOATSUI/" --output-hashing=all
Once code ready to deploy locally Click Azure icon from VS codeand connect to your Azure services and select your Appservice, in my case app-cr-dv-ISOATSAng and link your deployment folder clicking on "Deploy to Web"
Now you are all set to deploy code to ISOATSUI folder on Azure
By default Azure deoloyes code to common default location "C:\home\site\wwwroot"(you can find on Kudu) but here need to deploy in ISOATSUI folder, so we need to create virtual directory on Azure from
Now in Environment variables add key SCM_TARGET_PATH with value ISOATSUI
You can see newly added environment variable SCM_TARGET_PATH when you refreshed under your apservice
When working with Entity Framework Core in ASP.NET Core applications, generating DbContext and models is a crucial step. In this blog post, we'll explore three methods to simplify this process: using scaffolding commands, adhering to standard practices, and leveraging EF Core Power Tools in Visual Studio.
In this guide, we'll delve into the following three approaches to facilitate DbContext and model generation:
Step 1. Execute scaffolding command in Tools -- > NuGet Package Manager -- > Package Manager Console.
Step 2. Add the connection string directly.
scaffold-dbcontext -provider Microsoft.EntityFrameworkCore.SqlServer -connection "Data Source=(Server);Initial Catalog=(Database Name);UserId=(Username);Password=(Password);TrustServerCertificate=true;" -OutputDir ModelsStep 3. Scaffold DbContext and models using the Scaffold-DbContext command.
Step 1. Add connection string in app.settings.json.
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=(Server Name);Initial Catalog=(Database Name);user id=(Username for connection on db);password=(Password);TrustServerCertificate=True;"
}
}Step 2. Manually create a DbContext file. The class name should be ("DatabaseName"+Context.cs).
using Microsoft.EntityFrameworkCore;
namespace BackEnd.Models //solution name models
{
//**The class name should be ("DatabaseName"+Context.cs)**
// database name = TryDbApproch.
// class name = TryDbApprochContext.cs.
public class TryDbApprochContext : DbContext
{
public TryDbApprochContext(DbContextOptions<TryDbApprochContext> options)
: base(options)
{
}
}Step 3. Configure DbContext and connection string in program.cs.
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<TryDbApprochContext>(options =>
options.UseSqlServer(connectionString));or
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<TryDbApprochContext>(options => options.UseSqlServer(connectionString, serverOptions =>
{
serverOptions.EnableRetryOnFailure(
maxRetryCount: 3, // Maximum number of retry attempts
maxRetryDelay: TimeSpan.FromSeconds(30), // Maximum delay between retries
errorNumbersToAdd: null); // Specific error numbers to retry on (null retries on all transient errors)
}));Step 4. Scaffold DbContext and models using the Scaffold-DbContext command.
Scaffold-DbContext "Name=DefaultConnection" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -fStep 5. Paste the Scaffold string in the Tools -- > NuGet Package Manager -- > Package Manager Console. To generate models and DbContext files for the project.
Reverse Engineer acts like Entity Data Model, where it generates the tables of our database as Entity Classes in the code and also Db Context class based upon our Database.
Step 1. Install EF Core Power Tools extension in Visual Studio. Path = "Extension --> Manage Extensions... --> Search == EF Core Power Tools --> Install ".
Step 2. Right-click on Project. There, you will find an option installed, EF Core Power Tools.
Click on Reverse Engineer there you will find the Db Connection Option.


Step 3. Click on Add to connect with the Database Server.

Step 4. Test the connection with the SQL server.

Step 5. That's done! The Connection with the database will show in the selected DropDown -> Click on OK.

Step 6. Select the Tables which you want to include in your project and click on OK.

Step 7. By default, it will add the DB name as the Context name, which you can change if you want and also it will select Entitytypes & DbContext by default.

Step 8. You will get a confirmation, as shown below. Press "OK".

Step 9. Finally. The model Classes with Db Context have been generated automatically. This is how simple it is to work with EF Core Power Tools.
To add custom SOAP Security header to SOAP Envelope