简体   繁体   中英

Is it possible to reference a C# class that's not defined in a .nswag file?

I have a .Net Core project with multiple APIs that are generated by using Swagger (Nswag). I also have a few projects that contain shared classes that are used in multiple of the APIs and are not generated.

Now I want one generated controller method to return an object of a type that's specified in one of these model projects and written by myself (not generated by Swagger)

Is this even possible and, if yes, how can I achieve it?

您可以从生成中排除一些dto(我认为是它的ExcludedTypes设置),然后在您的命名空间中添加using(AdditionalNamespaceUsages)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM