Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

ModelBuilder OR Data Annotation

$
0
0

Hi

As I read in EF2.0 I am able to set a field as required

using data annotation by  writting [Required] before the property name 

OR

modelBuilder.Entity<Order>().Property(t => t.OrderDate).IsRequired();

My questions are:

Do they have the same exact effect?

Which one is recomended by microsoft?.

thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>