Reputation: 115
I have this simple .net core class library project and trying code first approach for CRUD.
Here is my code:
using System;
using System.Collections.Generic;
using System.Text;
using EFDemoApp_Domain.Entities;
using Microsoft.EntityFrameworkCore;
namespace EFDemoApp_Domain.DataAccess
{
public class EFDemoAppDataContext:DbContext
{
public EFDemoAppDataContext(DbContextOptions options):base(options)
{
}
public DbSet<Patient> Patients { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("");
}
}
}
In the statement public DbSet<Patient> Patients
the property name Patients
is showing as the below error:
Severity Code Description Project File Line Suppression State Error CS0053 Inconsistent accessibility: property type 'DbSet' is less accessible than property 'EFDemoAppDataContext.Patients'
I am not finding anywhere why this error is showing.
Upvotes: 2
Views: 906
Reputation: 2933
Without seeing it, I'm assuming your Patient
model is missing it's public accessor tag. As a reminder, if it's not specified then the default is internal
.
Upvotes: 5