i\'m having trouble configuring a foreign key relationship in my Entity Framework fluent Api:
Here is the head of the report:
public class Testata
{
There is a conflict between your foreign key property in class Dettaglio
...
public virtual int IDTEST { get; set; }
...which has a non-nullable type (int
) and therefore cannot be optional and your mapping...
this.HasOptional(t => t.TEST_TABLE) //...
...where you want the relationship to be optional.
If you indeed want an optional relationship use a nullable FK property:
public virtual int? IDTEST { get; set; }
Otherwise you must use HasRequired
for a required relationship with a non-nullable FK property.