I have created the model from existing database using Entity Framework in ASP.NET Core.
Here is the model of the Market
table
public partial class Market
{
public Guid MarketId { get; set; }
public string City { get; set; }
public string CityF { get; set; }
public string Name { get; set; }
public string NameF { get; set; }
public int SortOrder { get; set; }
public bool IsActive { get; set; }
}
However, I have change the MarketId
datatype to int
in the database. Now I want to update the model.
Found some link but this link create the entire model again https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db
How can I update the model without the creating new model and using the connection string in appsettings.json
?
Scaffold-DbContext
command with-force
flag. This way you can force scaffolding to overwrite existing model files. – GellerMarketId
toint
? – EquilibristScaffold-DbContext "<ConnectionString>" Microsoft.EntityFrameworkCore.SqlServer -t <tablename> -f
replace ConnectionString & tablename – Geller