Servicestack AutoQuery -> System.TypeLoadException 错误

Servicestack AutoQuery -> System.TypeLoadException Error

我正在尝试使用 C# AutoQuery 为现有 RDBMS 提供服务,但出现此错误:

  HResult=0x80131522
  Message=Type 'WebApplication1.ServiceModel.CreateCurrency' from assembly 'tmpCrudAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.
  Source=ServiceStack
  StackTrace:
   at ServiceStack.ServiceStackHost.OnStartupException(Exception ex)
   at ServiceStack.ServiceStackHost.OnStartupException(Exception ex, String target, String method)
   at ServiceStack.ServiceStackHost.RunPostInitPlugin(Object instance)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at ServiceStack.ServiceStackHost.RunAfterPluginsLoaded(String specifiedContentType)
   at ServiceStack.ServiceStackHost.OnAfterInit()
   at ServiceStack.ServiceStackHost.Init()
   at ServiceStack.NetCoreAppHostExtensions.UseServiceStack(IApplicationBuilder app, AppHostBase appHost)
   at Program.<Main>$(String[] args) in C:\Users\User\Desktop\Test\WebApplication1\WebApplication1\Program.cs:line 9

目标数据库是一个使用 BINARY(16) 作为主键的 mySQL 数据库。这可能是问题所在吗?当我以另一个 mySQL 数据库为目标时,它正常工作。

您可以控制 AutoGen 在配置 GenerateCrudServices 指令时生成数据模型和 API 的 table,例如,您可以排除特定的 table :

Plugins.Add(new AutoQueryFeature {
    GenerateCrudServices = new GenerateCrudServices {
        ExcludeTables = { "Currency" },
    }
});