Skip to content

Add option to auto-create Properties column as DataType SqlXml  #130

Closed
@jducobu

Description

@jducobu

I work on a console developed in .net core 2.0.
In the appsettings.json file, i have this declaration:

"Serilog": {
    "Using": [ "Serilog.Sinks.MSSqlServer" ],
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "MSSqlServer",
        "Args": {
          "connectionString": "Server=.;Database=Serilog;Trusted_Connection=True;MultipleActiveResultSets=true;",
          "tableName": "log",
          "columnOptionsSection": {
            "customColumns": [
              {
                "ColumnName": "EventType",
                "DataType": "int",
                "AllowNull": false
              },
              {
                "ColumnName": "Release",
                "DataType": "varchar",
                "DataLength": 32
              }
            ]
          },
          "autoCreateSqlTable": "true"
        }
      }
    ]
  }

The log table have a properties column's datatype set to nvarchar(max), not xml.

image

A workaround is to exexute this command :

ALTER TABLE [dbo].[log] ALTER COLUMN Properties XML

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions