Inconsistent accessibility problem
c#, datacontext
Solution
Your `DB` class is not public, so you can't make a `public` method (or constructor) that takes it as a parameter. (What would callers outside your assembly do?)
You need to either make the `DB` class `public` or make the `SqlCatalogRepository` class (or its constructor) `internal`.
Which one you do will depend where your types are being used. If the `SqlCatalogRepository` is only meant to be used inside your assembly, you should make it `internal`. (`internal` means that it's only visible to other types in the same assembly)
If it's meant to be exposed by your assembly to other assemblies, you should make the class `public` but the constructor `internal`.
If the `DB` class itself is meant to be used by types outside your assembly, you should make the `DB` class itself `public`.
Problem
I am following Rob Conery MVC Storefront tutorial series and I get an Inconsistent accessibility error from the following constructor public SqlCatalogRepository(DB dataContext) : ``` public class SqlCatalogRepository : ICatalogRepository { DB db; public SqlCatalogRepository() { db = new DB(); //turn off change tracking db.ObjectTrackingEnabled = false; } public SqlCatalogRepository(DB dataContext) { //override the current context //with the one passed in db = dataContext; } ``` Here is the error message : Error 1 Inconsistent accessibility: parameter type 'SqlRepository.DB' is less accessible than method 'Data.SqlCatalogRepository.SqlCatalogRepository(SqlRepository.DB)'