When I work with code first when I have a navigation property and work with Map, is that navigation property just for the code?
Another question, my primary key is a ProviderId string, how do I tell EF that my PK is not identity?
public class Proveedor
{
public string ProveedorId { get; set; }
public string RazonSocial { get; set; }
public string RUC { get; set; }
public string DNI { get; set; }
public string Direccion { get; set; }
public string Fijo { get; set; }
public string Celular { get; set; }
public string Representante { get; set; }
public string Email { get; set; }
public ICollection<Producto> Productos { get; set; }
}
Map
public class ProveedorMap : EntityTypeConfiguration<Proveedor>
{
public ProveedorMap()
{
ToTable("Proveedores");
HasKey(c => c.ProveedorId);
Property(c => c.ProveedorId).IsRequired().HasMaxLength(6).HasColumnOrder(0)
Property(c => c.RazonSocial).IsRequired().HasMaxLength(200).HasColumnOrder(1);
Property(c => c.RUC).HasMaxLength(11).HasColumnOrder(2);
Property(c => c.DNI).HasMaxLength(8).HasColumnOrder(3);
Property(c => c.Direccion).HasMaxLength(100).HasColumnOrder(4);
Property(c => c.Fijo).HasMaxLength(9).HasColumnOrder(5);
Property(c => c.Celular).HasMaxLength(9).HasColumnOrder(6);
Property(c => c.Representante).HasMaxLength(100).HasColumnOrder(7);
Property(c => c.Email).HasMaxLength(100).HasColumnOrder(8);
}
}
The navigation property does not go in MapMap.