using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
namespace MvcMovie.Models
{
[Table("_Partner")]
public class Partner
{
[Key]
public int Sifra { get; set; }
public string Naziv { get; set; }
public string Mesto { get; set; }
public string Pib { get; set; }
public string Adresa { get; set; }
public int? Region1 { get; set; }
public int? Region2 { get; set; }
public int? Region3 { get; set; }
public decimal? HRabat { get; set; }
}
public class PartnerDBContext : DbContext
{
public DbSet Partners { get; set; }
}
}
Where int? and decimal? are fields with NULL values.
One example of connection string in web.config is like:
If you have for name of table something like _Partner, like me :), then use [Table("_Partner")], for Key [Key]...
Using System.ComponentModel.DataAnnotations
From here.