C
C#12mo ago
Serene Sphinx

Error: Inconsistent accessibility: property type 'type' is less accessible than property 'property'

Error: Inconsistent accessibility: property type 'type' DbSet<Users> is less accessible than property 'property'EFCoreDbContext.User.
No description
No description
10 Replies
SinFluxx
SinFluxx12mo ago
internal is less accessible than public also you'd ideally name your model User and your dbset Users
Serene Sphinx
Serene SphinxOP12mo ago
Can I make internal as public? will this work?
SinFluxx
SinFluxx12mo ago
try it and see
Serene Sphinx
Serene SphinxOP12mo ago
Yess Error: The entity type 'Users' requires a primary key to be defined. If you intended to use a keyless entity type,
SinFluxx
SinFluxx12mo ago
with EF you'd typically have a property on your model like Id or you can define what you want your key to be by using the [Key] attribute on that property (would need to be something that's unique)
Serene Sphinx
Serene SphinxOP12mo ago
Okay New error occured now: Error: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure' to the 'UseSqlServer' call. Why this error what's wrong here now?
SinFluxx
SinFluxx12mo ago
It tells you in the error what you can try to rectify it:
Consider enabling transient error resiliency by adding 'EnableRetryOnFailure' to the 'UseSqlServer' call.
Serene Sphinx
Serene SphinxOP12mo ago
I'm new and learning EFCore I don't have idea
Serene Sphinx
Serene SphinxOP12mo ago
Soo thanks
Want results from more Discord servers?
Add your server