I have added Dbset in Context i.e.
public Dbset<Demo> Demo{ get; set; }
but I am getting compilation error here i.e.
Error 1 Inconsistent accessibility: property type 'System.Data.Entity.DbSet<MVC.Model.Demo>' is less accessible than property 'MVC.Model.Demo' D:Files/project 210 34 MVC.Data
Here is my Model:-
class Demo
{
[Key]
[Display(Name = "ID", ResourceType = typeof(Resources.Resource))]
public long Id { get; set;}
[Display(Name = "CountryID", ResourceType = typeof(Resources.Resource))]
public long CountryId { get; set; }
[Display(Name = "RightID", ResourceType = typeof(Resources.Resource))]
public long RightId { get; set; }
[Display(Name = "Amount", ResourceType = typeof(Resources.Resource))]
public double Amount { get; set; }
}
Demo
has no access modifier and classes are internal
by default, so it is less accessible than the DbSet
Demo
which is public
. Also, you should probably call the DbSet
Demos
so as not to confuse the two and since semantically it holds a set of Demos.
Since the set is public:
public DbSet<Demo> Demo { get; set; }
You need to make the Demo class public as well:
public class Demo
{
....
}
As mentioned, I also suggest you change the set to:
public DbSet<Demo> Demos { get; set; }
so that you don't confuse the set with the class type.
you should make your model public, so just change it to
public class Demo{}
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