Answer the question
In order to leave comments, you need to log in
How to change the structure of the model (tables) formed using the Entity Framework?
Technologies used
Entity Framework
ASP.NET CORE 3.1
Suppose the following model was initially formed, which was then converted to a table
public class MyModel{
public Guid Id { get; set; }
public string Title { get; set; }
public string Subtitle { get; set; }
public string Text { get; set; }
public string TitleImagePath { get; set; }
}
public class MyModel{
public Guid Id { get; set; }
public string Title { get; set; }
public string Text { get; set; }
public string TitleImagePath { get; set; }
public int View { get; set; }
public string Tag { get; set;}
}
Answer the question
In order to leave comments, you need to log in
Probably you need to read about Migrations .
Added fields must be null or contain a default value. Then, when adding a field, the data will not be deleted.
Deleting fields usually doesn't delete records unless you touch the keys.
The data in the linked tables is not touched if the data is not deleted from the main table and the keys on the basis of which the links are made are not touched.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question