the code below is from random source and is in .Net Framework and I am trying to convert it to .Net 6. As I am new to .Net 6, I'm unable to figure out which statements I should reuse while migration. I tried using .Net 6 style for getting my settings key and values but however I get objt ref is required for non-static exception.
public abstract class ServiceBase : IDisposable
{
//newly added
//start
private readonly PrintSettings _PrintSettings;
public ServiceBase(IOptions<PrintSettings> options)
{
_PrintSettings = options.Value;
}
//end
// Problem is here, object ref required for non static.
public ServiceBase() : this(_PrintSettings.DBConnection()) { }
protected ServiceBase(string instance)
{
this.proxy = new Proxy(instance);
}
public void BeginTran()
{
this.proxy.GetContext().BeginTran();
}