I don´t know if this is the right way to do this. Here is my class generated from Entities 6.xx:
namespace bd.inputdata.edmx
{
using model;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
[MetadataType(typeof(Usuario))]
public partial class input_usuario
{
public int id { get; set; }
public string nome { get; set; }
public string usuario { get; set; }
public string senha { get; set; }
public string email { get; set; }
public int id_grupo { get; set; }
public System.DateTime data_criacao { get; set; }
public System.DateTime data_alteracao { get; set; }
public Nullable<int> tipo { get; set; }
public byte ativo { get; set; }
}
}
I have created another class for data anottions, as seen here.
using System;
using bd.inputdata.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace bd.inputdata.model
{
[Table("usuario")]
public class Usuario : IRaizDeAgregacao
{
[Key]
public int id { get; set; }
[Required]
[StringLength(150)]
public string nome { get; set; }
[Required]
[StringLength(100)]
public string usuario { get; set; }
[Required]
[StringLength(100)]
public string senha { get; set; }
[Required]
[StringLength(50)]
public string email { get; set; }
[Required]
public int id_grupo { get; set; }
[Timestamp]
public DateTime data_criacao { get; set; }
[Timestamp]
public DateTime data_alteracao { get; set; }
public int? tipo { get; set; }
public byte ativo { get; set; }
}
}
When I try to save in the context this new class Usuario, it says I cant:
So what is the best way to correct this?