ServiceStack AutoQuery - Table 不可访问

ServiceStack AutoQuery - Table not accessibele

当我尝试使用 IncludeTables 属性 时,table 未生成或无法使用 AutoQuery API 访问。调用 /metadata 时,我只看到这两个端点:

有没有办法对此进行调试,或者有人知道为什么 AutoQuery 没有提取 table 吗?

已编辑: 当我调用 https://localhost:5001/crud/tables 时,我可以看到产品 table 作为结果 ...

appHost.Plugins.Add(new AutoQueryFeature
    {
        MaxLimit = 1000,
        GenerateCrudServices = new GenerateCrudServices
        {
            AutoRegister = true,
            CreateServices = new List<CreateCrudServices>
            {
                new CreateCrudServices
                {
                    IncludeTables = new List<string> { "product"}
                },

            }
        }
    });

更新:

@mythz 我检查了 table 模式,但没有发现任何错误 (MySql)。这些是列:

[
  {
     "ColumnName":"id",
     "ColumnOrdinal":1,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":true,
     "BaseColumnName":"id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":false,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) PRIMARY KEY"
  },
  {
     "ColumnName":"version_id",
     "ColumnOrdinal":2,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":true,
     "BaseColumnName":"version_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":false,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) PRIMARY KEY"
  },
  {
     "ColumnName":"auto_increment",
     "ColumnOrdinal":3,
     "ColumnSize":11,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"auto_increment",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Int32",
     "AllowDBNull":false,
     "ProviderType":3,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":true,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"INT",
     "ColumnDefinition":"INT NOT NULL"
  },
  {
     "ColumnName":"parent_id",
     "ColumnOrdinal":4,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"parent_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":true,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NULL"
  },
  {
     "ColumnName":"parent_version_id",
     "ColumnOrdinal":5,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"parent_version_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":true,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NULL"
  },
  {
     "ColumnName":"media_id",
     "ColumnOrdinal":6,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"media_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":true,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NULL"
  },
  {
     "ColumnName":"cms_page_id",
     "ColumnOrdinal":7,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"cms_page_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":true,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NULL"
  },
  {
     "ColumnName":"cms_page_version_id",
     "ColumnOrdinal":8,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"cms_page_version_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":false,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NOT NULL"
  },
  {
     "ColumnName":"product_stream_id",
     "ColumnOrdinal":9,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"product_stream_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":true,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NULL"
  },
  {
     "ColumnName":"product_assignment_type",
     "ColumnOrdinal":10,
     "ColumnSize":32,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"product_assignment_type",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.String",
     "AllowDBNull":false,
     "ProviderType":253,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"VARCHAR",
     "ColumnDefinition":"VARCHAR(32) NOT NULL"
  },
  {
     "ColumnName":"path",
     "ColumnOrdinal":11,
     "ColumnSize":-1,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"path",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.String",
     "AllowDBNull":true,
     "ProviderType":752,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":true,
     "IsReadOnly":false,
     "DataTypeName":"VARCHAR",
     "ColumnDefinition":"VARCHAR NULL"
  },
  {
     "ColumnName":"after_category_id",
     "ColumnOrdinal":12,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"after_category_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":true,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NULL"
  },
  {
     "ColumnName":"after_category_version_id",
     "ColumnOrdinal":13,
     "ColumnSize":16,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"after_category_version_id",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte[]",
     "AllowDBNull":true,
     "ProviderType":754,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"BLOB",
     "ColumnDefinition":"BLOB(16) NULL"
  },
  {
     "ColumnName":"level",
     "ColumnOrdinal":14,
     "ColumnSize":11,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"level",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.UInt32",
     "AllowDBNull":false,
     "ProviderType":503,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"INT",
     "ColumnDefinition":"INT NOT NULL"
  },
  {
     "ColumnName":"active",
     "ColumnOrdinal":15,
     "ColumnSize":1,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"active",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Boolean",
     "AllowDBNull":false,
     "ProviderType":1,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"tinyint",
     "ColumnDefinition":"TINYINT(1) NOT NULL"
  },
  {
     "ColumnName":"child_count",
     "ColumnOrdinal":16,
     "ColumnSize":11,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"child_count",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.UInt32",
     "AllowDBNull":false,
     "ProviderType":503,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"INT",
     "ColumnDefinition":"INT NOT NULL"
  },
  {
     "ColumnName":"display_nested_products",
     "ColumnOrdinal":17,
     "ColumnSize":1,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"display_nested_products",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte",
     "AllowDBNull":false,
     "ProviderType":501,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"INT",
     "ColumnDefinition":"INT NOT NULL"
  },
  {
     "ColumnName":"visible",
     "ColumnOrdinal":18,
     "ColumnSize":1,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"visible",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.Byte",
     "AllowDBNull":false,
     "ProviderType":501,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"INT",
     "ColumnDefinition":"INT NOT NULL"
  },
  {
     "ColumnName":"type",
     "ColumnOrdinal":19,
     "ColumnSize":32,
     "NumericPrecision":0,
     "NumericScale":0,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"type",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.String",
     "AllowDBNull":false,
     "ProviderType":253,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"VARCHAR",
     "ColumnDefinition":"VARCHAR(32) NOT NULL"
  },
  {
     "ColumnName":"created_at",
     "ColumnOrdinal":20,
     "ColumnSize":23,
     "NumericPrecision":0,
     "NumericScale":3,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"created_at",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.DateTime",
     "AllowDBNull":false,
     "ProviderType":12,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"DATETIME",
     "ColumnDefinition":"DATETIME(23) NOT NULL"
  },
  {
     "ColumnName":"updated_at",
     "ColumnOrdinal":21,
     "ColumnSize":23,
     "NumericPrecision":0,
     "NumericScale":3,
     "IsUnique":false,
     "IsKey":false,
     "BaseColumnName":"updated_at",
     "BaseSchemaName":"shopware_6_demo",
     "BaseTableName":"category",
     "DataType":"System.DateTime",
     "AllowDBNull":true,
     "ProviderType":12,
     "IsAliased":false,
     "IsExpression":false,
     "IsAutoIncrement":false,
     "IsRowVersion":false,
     "IsHidden":false,
     "IsLong":false,
     "IsReadOnly":false,
     "DataTypeName":"DATETIME",
     "ColumnDefinition":"DATETIME(23) NULL"
  }
]

使用 IncludeTables 后,table 选择变为 opt-in“white-list”。 CancelRequestGetFile 是与 AutoQuery 无关的 built-in API。

您可以通过调用静态方法测试 Tables AutoQuery 解析的内容,例如:

var tableSchemas = GenerateCrudServices.GetTableSchemas(dbFactory, 
    includeTables:new List<string> { "product" });

如果您关闭 includeTables 过滤器,您可以检查指定模式(如果提供 none 则为默认模式)生成的 table 元数据,您可以在其中检查RDBMS 元数据中带有 tableSchemas[0].Name.

的名称