Thank you for the fast response, following your advice, I captured the SQL for creating the table:
[12:42:46 DBG] SQL: SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CrudEvent' AND TABLE_SCHEMA <> 'Security'
[12:42:46 DBG] SQL: CREATE TABLE "CrudEvent"
(
"Id" BIGINT PRIMARY KEY IDENTITY(1,1),
"EventType" VARCHAR(8000) NULL,
"Model" VARCHAR(8000) NULL,
"ModelId" VARCHAR(8000) NULL,
"EventDate" DATETIME NOT NULL,
"RowsUpdated" BIGINT NULL,
"RequestType" VARCHAR(8000) NULL,
"RequestBody" VARCHAR(8000) NULL,
"UserAuthId" VARCHAR(8000) NULL,
"UserAuthName" VARCHAR(8000) NULL,
"RemoteIp" VARCHAR(8000) NULL,
"Urn" VARCHAR(8000) NULL,
"RefId" INTEGER NULL,
"RefIdStr" VARCHAR(8000) NULL,
"Meta" VARCHAR(MAX) NULL
);
I manually created the table above as Security.CrudEvent. All my data is Unicode based, so I took the liberty of using NVARCHAR instead of VARCHAR, with the corresponding length adjustments.
After calling a POST service to create an entity, I receive the error:
{
"result": null,
"responseStatus": {
"errorCode": "SqlException",
"message": "Invalid object name 'CrudEvent'.",
"stackTrace": "[CreateBrand: 2020-12-14 15:28:11]:\n[REQUEST: {name:Gold,commodityId:34aa96581d3eeb11b514482ae316d296,brandOriginId:87ab96581d3eeb11b514482ae316d296,brandStatusTypeId:64ab96581d3eeb11b514482ae316d296,statusDate:\"2016-04-24T20:18:18Z\"}]\r\nSystem.Data.SqlClient.SqlException (0x80131904): Invalid object name 'CrudEvent'.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method)\r\n at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)\r\n at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n at ServiceStack.OrmLite.OrmLiteCommand.ExecuteNonQuery() in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteCommand.cs:line 43\r\n at ServiceStack.OrmLite.OrmLiteResultsFilterExtensions.ExecNonQuery(IDbCommand dbCmd) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteResultsFilterExtensions.cs:line 64\r\n at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.InsertInternal[T](IOrmLiteDialectProvider dialectProvider, IDbCommand dbCmd, Object obj, Action`1 commandFilter, Boolean selectIdentity) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteWriteCommandExtensions.cs:line 804\r\n at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.Insert[T](IDbCommand dbCmd, T obj, Action`1 commandFilter, Boolean selectIdentity) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteWriteCommandExtensions.cs:line 734\r\n at ServiceStack.OrmLite.OrmLiteWriteApi.<>c__DisplayClass5_0`1.<Insert>b__0(IDbCommand dbCmd) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteWriteApi.cs:line 72\r\n at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func`2 filter) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteExecFilter.cs:line 64\r\n at ServiceStack.OrmLite.OrmLiteReadExpressionsApi.Exec[T](IDbConnection dbConn, Func`2 filter) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteReadExpressionsApi.cs:line 16\r\n at ServiceStack.OrmLite.OrmLiteWriteApi.Insert[T](IDbConnection dbConn, T obj, Boolean selectIdentity) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\OrmLiteWriteApi.cs:line 72\r\n at ServiceStack.OrmLiteCrudEvents`1.Record(CrudContext context) in C:\\BuildAgent\\work\\3481147c480f4a2f\\src\\ServiceStack.Server\\CrudEvents.cs:line 213\r\n at ServiceStack.AutoQuery.ExecAndReturnResponse[Table](CrudContext context, Func`2 fn) in C:\\BuildAgent\\work\\3481147c480f4a2f\\src\\ServiceStack.Server\\AutoQueryFeature.AutoCrud.cs:line 779\r\n at ServiceStack.AutoQuery.Create[Table](ICreateDb`1 dto, IRequest req) in C:\\BuildAgent\\work\\3481147c480f4a2f\\src\\ServiceStack.Server\\AutoQueryFeature.AutoCrud.cs:line 401\r\n at QQL.ServiceInterface.BrandNs.BrandService.Post(CreateBrand request) in C:\\Yoyo\\QqcDesk\\QQL\\code\\backend\\QQL.ServiceInterface\\BrandNs\\BrandService.cs:line 46\r\n at ServiceStack.Host.ServiceRunner`1.ExecuteAsync(IRequest req, Object instance, TRequest requestDto) in C:\\BuildAgent\\work\\3481147c480f4a2f\\src\\ServiceStack\\Host\\ServiceRunner.cs:line 134\r\nClientConnectionId:4e48b28d-6647-470d-b943-698349521788\r\nError Number:208,State:1,Class:16\r\n",
"errors": [],
"meta": null
}
}
As the exception message is âInvalid object name âCrudEventâ.â, I suspect my table is not being used as I did not indicate it when configuring the audit. Should it be auto-discovered via the naming I saw in the generated SQL for creating the table?