Using [Foreignkey(")] - MVC

Asked

Viewed 57 times

2

This is my domain

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Dominio
{
    public class Bolsa_AlunoProva
    {
        public int ID { get; set; }
        public int Nota { get; set; }
        public DateTime DataInicial { get; set; }
        public DateTime DataFinal { get; set; }

        public virtual Bolsa_Aluno Aluno { get; set; }

        [ForeignKey("Bolsa_ProvaID")]
        public virtual Bolsa_Prova Prova { get; set; }

    }
}

However, I cannot use the [ForeignKey("Bolsa_ProvaID")] because it points to lack of references. However, the necessary reference is not only System.ComponentModel.DataAnnotations ?

@Edit

inserir a descrição da imagem aqui

  • You can put exactly the error that is appearing to you in your question?

2 answers

2


1

The correct using is the: System.ComponentModel.DataAnnotations.Schema;

  • Unfortunately . Schema is not recognized in my application. I edited my question and added a print.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.