IsNemoEqualTrue/monitor-table-change-with-sqltabledependency

GetBaseObjectsNamingConvention not really usable

Closed this issue · 1 comments

This is related to #149. I want to pass my own suffix for object generated on the server (not only triggers, but all of them). I tried to override GetBaseObjectsNamingConvention this way:

public MyTableDependency(string connString, string tableName, string suffix)
        : base(connString, tableName)
{
    this.suffix = suffix;
}

override protected string GetBaseObjectsNamingConvention()
{
    return $"{this._tableName}_{this.suffix}";
}

But unfortunately, the method gets called in the base constructor, so the suffix is not set when called.

The best in my opinion would be to pass the correct suffix (object naming convention) as an argument, as in earlier releases (I am upgrading from 4.6.0). Or else, keep is as a virtual method, but make it possible to derive in a natural way like above.

I had to use a workaround involving a factory method and a static temporary variable.

This is not possible. Why? Because if the SqlTableDependency's database objects are already present, the system crash. In the early version, is was possible. But now not anymore. The functionality you are requesting will be available in release 9.x