Does the Required attribute have any effect on a navigation property?

c# data-annotations entity-framework entity-framework-6

Question

In an EF data model, I have the following code:

[Required]
public IdentityTypeDocument IdentityType { get; set; }

[Required]
[ForeignKey(nameof(IdentityType))]
public int? IdentityTypeId { get; set; }

Does the initialRequired - on theIdentityTypeDocument Compared to the second one, the property, what difference does it make?int property?

1
1
6/13/2017 5:33:53 AM

Accepted Answer

ZZZ_tmp
3
6/13/2017 5:55:22 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow