According with the Microsoft Documentation Here, I should have access to the Attribute for [Keyless] so I can define my Model has Keyless, so that in my DBContext I could have something like:
public DbSet<MyKeylessClass> KeylessModel { get; set; }
And use _context.KeylessModel.FromSqlRaw(...)
, without having the need to add a PK to it.
I have the reference to System.ComponentModel.DataAnnotations
and all the Attributes except Keyless are there, what am I missing here?
Well, the official EF Core 3.0 release documentation doesn't say a word about supporting that attribute yet, instead for keyless types they instruct to use HasNoKey() method:
ModelBuilder.Entity<MyKeylessClass>().HasNoKey()
You can read more here
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