The volleyball scoring of the MVC series Blog (III.) realization of model class

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.