C# extended class doesn't expose methods on different project

36 views Asked by At

I'm scratching my head on a problem that seems easy...I've published a NuGet package on my private server. This contains the SqlDb class:

public class SqlDb
{
    public void SetConnectionString(string connectionString)
    {
        // CODE
    }
}

The goal is to use this package in another solution with two projects: App.Database and App.Server. On App.Database I would like to manage all methods to MySQL and access them from App.Server.

App.Database contains:

public class Db : SqlDb
{
}

App.Server contains:

internal class Program
{
    static void Main(string[] args)
    {
        var db = new Db();
        db.SetConnectionString(args[0]);
    }
}

App.Server has a reference to App.Database (I can access Db() class) but I can't see inherited methods from SqlDb (like SetConnectionString()).

Someone can help me to understand what I'm doing wrong ? Should I rewrite each method like:

public class Db : SqlDb
{
    public void SetConnectionString(string connectionString)
    {
        base.SetConnectionString(connectionString);
    }
}

I hope not...

0

There are 0 answers