JSON的最佳实现 [英] Best implementation of JSON

查看:95
本文介绍了JSON的最佳实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要实施一些服务,唯一的限制是必须是json。



许多foruns,博客,讨论和最终决定都转向特定案例和限制。对于这种特定的实现,飞行限制是:

DB是MS SQL

语言是C#

客户端和服务器属于相同的基础架构(否)需要沟通/认证技巧)

我将使用Visual Studio方便。



那么根据你的经验我应该使用什么?

WCF?

MVC?

Web API?

其他......?



有很多不同方法的文章,比如:

JSON和Microsoft技术 [ ^ ]

但我不知道为什么我应该选择另一个选项:



谢谢,

Rui Silva

解决方案

如果你不需要认证,复杂的安全性,复杂的消息类型等,你的电话只是通过http或https,然后WebAPI可能是你最好的选择。它比WCF更轻,更简单。 WCF为您提供了更多功能,但是配置起来比较困难,如果您不使用这些功能,那么在您不需要的时候就无需了解WCF配置。



您需要考虑的另一件事是托管您的服务... WCF和WebAPI都可以托管在普通的asp.net网站中,或者在他们自己的进程中托管,但这是你要做的事情需要考虑。再简单一点,如果您要使用WebAPI,那么在IIS中托管将是最简单的方法。


此时,问题根本没有意义。你了解关注点分离和分而治之的原则吗?此外,您只需要避免不相关的事物的人为(偶然)耦合。架构模式或ASP.NET框架之间的选择与JSON工具或库的选择无关。单独决定这些问题,这就是解决方案。但也许这是一个不存在的问题的解决方案,因为你并没有真正制定任何问题,所以它可能只是你的头脑。



请参阅:

https://en.wikipedia.org/wiki/Separation_of_concerns [ ^ ],

https://en.wikipedia.org/wiki/Divide_and_conquer [ ^ ],

https://en.wikipedia.org/wiki/Abstraction_principle_%28computer_programming%29 [ ^ ],

https://en.wikipedia.org/wiki/Coupling_%28computer_programming%29 [ ^ ]。



-SA

Hi all,

I need to implement some services whit the only limitation that has to be json.

Many of the foruns, blogs, discussions and final decisions turns to be around particular cases and restrictions. For this especific implementation the flew restricitons are:
DB is MS SQL
Language is C#
Client and Server are in the same infraestructure (no communication/authentication tricks needed)
I will use Visual Studio for convenience.

So according to your experience what i should use?
WCF?
MVC?
Web API?
Others ...?

There are amazing articles with the diferent methods, like this:
JSON and Microsoft technologies[^]
But i dont know why should i pick one option over another:

Thanks,
Rui Silva

解决方案

If you don't need authentication, complex security, complex message types etc, and your calls are just going over http or https then WebAPI is probably your best bet. It's lighter and simpler than the likes of WCF. WCF gives you a lot more features, but it's harder to configure and if you're not using those features there is no point getting your head around WCF config when you don't need to.

The other thing you need to think about is what is hosting your service...WCF and WebAPI can both be hosted in a normal asp.net site, or in their own processes, but it's something you'll need to consider. Again for simplicity if you're going for WebAPI then hosting in IIS will be the simplest way.


At this moment, the question does not makes sense at all. Do you understand the principles "separation of concerns" and "divide and conquer"? Also, you simply need to avoid artificial (accidental) coupling of unrelated things. The choice between architectural patterns or ASP.NET frameworks have nothing to do with the choice of JSON tools or libraries. Decide separately on those issues, that's the solution. But perhaps this is a solution to the problem which does not exist, because you did not really formulate any, so it could be just all in your head.

Please see:
https://en.wikipedia.org/wiki/Separation_of_concerns[^],
https://en.wikipedia.org/wiki/Divide_and_conquer[^],
https://en.wikipedia.org/wiki/Abstraction_principle_%28computer_programming%29[^],
https://en.wikipedia.org/wiki/Coupling_%28computer_programming%29[^].

—SA


这篇关于JSON的最佳实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆