NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
860 stars 170 forks source link

Expose SQLErrorStore._tableName through config or allow setting it afterwards #118

Closed stijnherreman closed 6 years ago

stijnherreman commented 6 years ago

When using ErrorStoreSettings via services.AddExceptional(...) or Exceptional.Configure(...), the SQL store is created with "Exceptions" as table name.

Can you expose store-specific settings through the configuration? If not, can you expose private readonly string _tableName; to be set in code afterwards?

I can create a PR if you give some guidelines for how you'd like to see it built.

NickCraver commented 6 years ago

Trying to understand the ask here. Setting it in code after wouldn't work because it's denormalized for efficiency (we don't create the query strings every time...just once and memoize). So we need to do it on creation.

Do you want the table name to be something you can specify from the JSON (or whatever your config source is)? Or am I misunderstanding the request?

stijnherreman commented 6 years ago

Yeah, I'd like to specify the table name and the schema name via configuration.

NickCraver commented 6 years ago

@stijnherreman git auto-closed this, but packages should be up on MyGet shortly adding TableName to the store settings. Example JSON confiig:

{
  "Exceptional": {
    "Store": {
      "ApplicationName": "Samples (ASP.NET Core SQL)",
      "Type": "SQL",
      "ConnectionString": "Server=.;Database=Local.Exceptions;Trusted_Connection=True;",
      "TableName": "MyExceptions"
    }
  }
}
stijnherreman commented 6 years ago

Thanks, verified that it's working.