User-1660589204 posted
I am creating DBcontext with EF for my SQL DB and C# project. In which I created a model that represents my SQL data table. Code is:
class FileDetails
{
public string FileUrl { get; set; }
public string Filename { get; set; }
public string Case_ID { get; set; }
public string FileType { get; set; }
public Int64 File_Reference_Id { get; set; }
public DateTime Created_Date { get; set; }
public DateTime Updated_Date { get; set; }
public string Status { get; set; }
public string File_Id { get; set; }
public string Preset { get; set; }
public string Transcode_callbackUrl { get; set; }
public string FileTranscodeJob_Id { get; set; }
public string Transcription_callbackUrl { get; set; }
public string jobDefinition { get; set; }
public string TranscriptionJob_Id { get; set; }
}
If I have multiple files, I set a DbSet for the same in my context file:
public class RSBContext:DbContext
{
RSBContext()
{ }
public RSBContext(DbContextOptions<RSBContext> options):base(options)
{ }
public virtual DbSet<FileDetails> FilesDetails { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseSqlServer("Server=dev-nsconnect-rds.c2kwqwuzlbpz.ca-central-1.rds.amazonaws.com;User Id=admin;Password=Viq2021!; Database=rsbsrdb;MultipleActiveResultSets=true");
}
}
}
The highlighted declaration shows compile time error:
Inconsistent accessibility: Property type DbSet<FileDetails> is less accessible than property 'RSBContext.FileDetails'. Both model and context are in same folder "Models". Can anyone please help me with this?