I am trying to create Repository , Entity framework for Portable Class Library , when ever I try to Nuget EntityFramework
it is Failed to add reference to 'System.ComponentModel.DataAnnotations'. Please make sure that it is in the Global Assembly Cache.
Any Idea to resolve this for EF
Compatible EF package for Portable Library
You can use fluent Api, don't use data annotations and attributes in the model class.
Example: for defining a primary key; instead of using [Key]
tag, use:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Record>().HasKey<int>(s => s.ID);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With