I initially used a connection database method to establish a data connection, and then listened to the students to use the EF framework to generate automatic database connection, it feels good, and then I re-use the EF framework to build the database
Using the EF framework to generate the database, there are corresponding model classes, and the model classes are as follows:
public int ID {get; set;}
[DisplayName ("player number")]
public string Name {get; set;}
[DisplayName ("player name")]
public string Teamname {get; set;}
[DisplayName ("Team name")]
public string Status {get; set;}
[DisplayName ("player positioning")]
This is the individual fields of the database, DisplayName is the text displayed on the page, which can be understood as aliases for the field.
public class Pdbcontext:dbcontext
{
Public dbset<players> player {get; set;}
}
This is the system automatically generated data table
The following code, like the one above, is also the model class build database
public class Score
{
public string ScorePlayer1 {get; set;}
[DisplayName ("Chinese team scoring player")]
public int TotalScore1 {get; set;}
[DisplayName ("Chinese team total score")]
public string ScoreType1 {get; set;}
[DisplayName ("Score type")]
public string ScorePlayer2 {get; set;}
[DisplayName ("Serbia scoring player")]
public int TotalScore2 {get; set;}
[DisplayName ("Serbia total score")]
public string ScoreType2 {get; set;}
[DisplayName ("Score type")]
public class Gdbcontext:dbcontext
{
Public dbset<score> Students {get; set;}
}
}
The volleyball scoring of the MVC series Blog (III.) realization of model class