ASP.NET Core 2.0 Razor与Angular/React/etc等 [英] ASP.NET Core 2.0 Razor vs Angular/React/etc

查看:101
本文介绍了ASP.NET Core 2.0 Razor与Angular/React/etc等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的团队已经获得了用于开发企业级Web应用程序的资金(不会详细介绍其功能).该应用程序将有许多单独的网页,但是其中两个页面更加集中且非常繁琐-就像许多用户交互,显示大量数据的模式,Websocket连接,聊天等一样繁重.

My team and I have received funding to start developing an Enterprise level web application (won't go into details of what it does). The application will have many separate web pages but two of those pages being more focused and very heavy - heavy as in a lot of user interaction, modals that display mass data, websocket connections, chat, etc.

我已被分配为该项目的首席架构师,因此我正在对最新的Web框架进行一些研究.对于后端,我们已经进行了一些测试,并决定使用Azure SQL平台.到目前为止,我喜欢ASP.NET Core 2.0所做的改进.特别是Razor引擎,它是ASP.NET MVC早期版本的基础.

I have been assigned to Chief Architect on the project, so I am doing some research into the latest web frameworks. For the back end, we have done some testing and have decided to go with the Azure SQL platform. So far, I am liking the improvements that have been made, and are being made, to ASP.NET with Core 2.0. Specifically the Razor engine, over previous versions of ASP.NET MVC.

我想对新" Razor vs. Angular/React之类的东西获得一些专家意见.我特别关注性能. Core 2.0 Razor如何支持客户端渲染框架?差异可以忽略不计吗?我们的应用定位到潜在的1,000,000用户(大约100,000个并发用户).

I wanted to get some expert opinions on the "new" Razor vs. Angular/React and the like. I'm particularly more concerned with performance. How does Core 2.0 Razor hold up to client side rendering frameworks? Are the differences negligible? Our app is targeting a potential 1,000,000 users (roughly 100,000 concurrent).

提前谢谢!

推荐答案

我们最终使用Azure SQL开发了一个Angular前端和一个ASP.NET Core API后端.我们测试了Core Razor,尽管比传统Razor更好,但最终Angular对我们而言要快得多.就用户体验而言,Angular(或React)在性能方面要优越得多.我们发现Angular的模型绑定方面是服务器端渲染的巨大优势.但是,使用Razor(或一般来说是服务器端渲染)确实可以在数据传输方面更好地提高整体完整性,并且可以更好地将数据从前端过渡到后端.前端框架和API之间确实存在脱节.传递给服务器的所有数据都必须转换为类型化的对象-这意味着您必须管理两个单独的POCO模型集.如果服务器对象和前端对象未对齐,则可能导致问题.目前,Entity Framework Core还不是很成熟,因此我们在更新对象,查询对象(包括子对象等)方面遇到问题.

We ended up going with an Angular front-end and an ASP.NET Core API backend, using Azure SQL. We tested Core Razor and, although better than legacy Razor, Angular was much faster for us in the end. As far as user experience goes, Angular (or React) is far superior in terms of performance. The model-binding aspects of Angular we found to be a gigantic advantage of server-side rendering. Using Razor(or server side rendering in general) does, however, lend itself to better overall integrity as far as data goes and it makes for a better transition of data from front-end to back-end. There is a true disconnect between a front-end framework and an API. All data that is passed to the server has to be cast into typed objects - this means you have to manage two separate POCO model sets. This can cause issues if server objects and front-end objects do not align. At the moment, Entity Framework Core is not very matured so we have issues with updating objects, querying objects, including child objects, etc.

总体而言,到目前为止,此设置对我们来说非常有用!我想如果您更喜欢React,它将是Angular的类似替代品.我必须学习Angular,这是一个非常简单的过渡,现在我很喜欢它!

Overall, this setup has worked out great for us so far! I would imagine React would be a similar replacement to Angular if you're more comfortable with it. I had to learn Angular, which was a very easy transition, and I love it now!

这篇关于ASP.NET Core 2.0 Razor与Angular/React/etc等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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