简体   繁体   English

C# Class 库或 Web API

[英]C# Class Library or Web API

I have an ASP.NET MVC 5 Web Application that talks to an AS400 backend system.我有一个与 AS400 后端系统对话的 ASP.NET MVC 5 Web 应用程序。 I made calls to AS400 Programs through IBM iSeries Client Access Library我通过 IBM iSeries 客户端访问库调用了 AS400 程序

Which way is correct哪种方式是正确的

a) Create a class library with all functionalities and reference through my Web Application or a) 通过我的 Web 应用程序创建具有所有功能和参考的 class 库或

b) Create a Web API, make a reference to the class library and host it to IIS b) 创建一个 Web API,引用 class 库并将其托管到 Z5DA5ACF461B64EFB7E76ZEC861

I think this is a better solution because it would be in another application in IIS and not in the same process as in the first approach.我认为这是一个更好的解决方案,因为它将在 IIS 的另一个应用程序中,而不是在与第一种方法相同的过程中。 I will be more asynchronous.我会更加异步。 I'm right?我是正确的?

I used both a and b in same system(as400 and .net), but for different cases.我在同一系统(as400 和 .net)中同时使用了 a 和 b,但针对不同的情况。 If you want to isolate as400 things from your application, then go with web api(b).如果你想从你的应用程序中隔离 as400 事物,那么 go 和 web api(b)。 This will give you more flexibility to work(maintain wise).这将为您提供更大的工作灵活性(保持明智)。 And this way good if you have many functions with deal with.如果你有很多功能要处理,这种方式很好。 This will also make your life complex.这也会让你的生活变得复杂。 Like security...比如安检...

I used case a, when I just need to do only a login through as400 and few more things.我使用了案例 a,当我只需要通过 as400 登录和其他一些事情时。

Usability with other applications与其他应用程序的可用性

a) You can reference that dll to many other applications(.net only) a)您可以将 dll 引用到许多其他应用程序(仅限.net)

b) You can use api for almost any type of application b) 您可以将 api 用于几乎任何类型的应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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