If your table look like:
CREATE TABLE [dbo].[_Partner](
[Sifra] [int] NOT NULL,
[Naziv] [nvarchar](70) NULL,
[Mesto] [nvarchar](50) NULL,
[Pib] [nvarchar](20) NULL,
[Adresa] [nvarchar](50) NULL,
[Region1] [int] NULL,
[Region2] [int] NULL,
[Region3] [int] NULL,
[HRabat] [decimal](18, 2) NULL,
CONSTRAINT [PK__Partner] PRIMARY KEY CLUSTERED
(
[Sifra] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Then your model should look like:
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: