ASP .Net Core with Razor Pages Vs Angular for UI [closed]
Asked Answered
N

6

21

Our enterprise application is a massive (1000+ pages) app and primarily it is glorified data entry application. There is no major business process. All most all pages have CRUD. We are trying to re-architecture the entire application from a old code base (C/C++) - desktop app to web based app.

We started with Angular but with limited to NO knowledge on Javascript, it was a steep learning curve. FYI: All our developers know C#. We find it very difficult to on-board new developers into Angular/Javascript world.

All that said, I was looking into ASP .Net Core + Razor Pages and find it way easier to transition when compared to Angular. These are the advantages I have seen so far:

  1. Handle C# POCO within the HTML for binding. No need to convert to TS based POCO's.
  2. Model level validation using data annotations
  3. Default routing or custom routing at API level. One place to define the routing.
  4. Minimal JavaScript use. FYI: Trying to use WebAssembly as well. We are also looking into Blazor

Since it is a data entry system does client side rendering vs server side rendering, matter much?

Are there better advantage choosing Angular with .Net Core Web API over ASP .Net Core 2 + Razor Pages?

Narcotic answered 3/6, 2019 at 6:9 Comment(0)
G
12

To start from the end, I'd advice you to use Blazor server-side SPA application.

Why use SPA

SPA is similar to desktop applications in its design And it's most suitable to be used with data entry forms I guess your team is made of desktop app (WinForms, WPF) developers, and they would easily start developing once they comprehend the Component Model on which Blazor or any other SPA framework is based.

Why use Blazor

  • Your developers are well-acquainted with C#, and has poor knowledge of JavaScript
  • Learning curve of JavaScript + SPA framework, such as Angular is much more higher than Blazor, whether you know JavaScript or not.

Note: It must be emphasized here that the ability to develop Blazor applications requires some learning investment, though not as high as, say, Angular, even if you are a well-experienced Razor Pages or MVC developer. Note also: Knowledge of C# (language), does not reflect Knowledge of (Asp).Net Core Framework.

  • Shared Libraries: This is one of the factors why to use Blazor. In Blazor, you can create projects that can be shared on the Client and the Server. As for instance, you can create your Model in a Shared project, and use it on both sides.

Why use Blazor server side

Blazor server side is most appropriate for enterprise applications running in private network.

  • All the resources are under your control
  • You don't have to use web requests. You can use services which access your database directly or through repositories.
  • Unlike public server-side Blazor, private server-side Blazor, especially one for your corporate is not likely to incur any meaningful Network latency, if at all.

You can really create fast and robust and desktop-like app that way

Hope this helps...

Note: I did not finish my answer, and I'll update it from time to time. Please, don't hesitate to ask whatever question you want.

Grout answered 3/6, 2019 at 9:36 Comment(5)
I cannot rely on Blazor as it is not yet in production and also not sure how much the community is going to adapt to this new technology. As I said this is a big enterprise app and do not want to end up in a technology that is not supported within a year or two.Narcotic
After careful reading about Blazor I am tending more towards your suggestion and also WebAssembly is quite interesting. The major issue I have is I am not able to find a basic Admin Template for Blazor. I currently have one for ASP .Net Core + Razor Pages template which would help me save a lot of time in terms of UI.Narcotic
Blazor definitely is what I'm looking forward to too, but it still does not have a stable release, I would advise against starting a production app on a platform that by itself has not seen a production release. ASP Net core v1, v1.1 were pretty rough releases, the marketing and the docs look good but when you get into the implementation detail, the lack of features start to hurt. I'd recommend starting with Razor Pages as you can directly port C# code to Blazor later on when it's stable.Malonis
This is the route that I have decided to take - From Angular I am moving to ASP .Net Core MVC - Razor Views (as it is more easy to convert to Blazor). Will hold on developing UI (concentrate more on business layer) until mid of 2020. By that time if Blazor is stable will move to Blazor else will stick with ASP .Net Core MVC. The major issue I see with Blazor is Lazy Loading functionality -github.com/aspnet/AspNetCore/issues/5465 .Narcotic
Sounds very prudent. One thing on that issue that worried me was, "However, Blazor today takes full ownership of the app and the DOM, so you can't really use MVC to render some HTML on the server and then use Blazor to manipulate the DOM on the client." Hope that changes, because every other front-end framework allows it.Malonis
M
10

This is a highly opinionated question but in general, Single Page Applications require an effort a few orders of magnitude larger than Server rendered pages. You will have to duplicate logic on the C# backend and the typescript front-end. You will have to deal with tons of bugs as you code the front-end in a non type safe dynamic language that has arguably questionable constructs. In the end, Single Page Apps are worth it because they provide a rich and engaging experience to the end user if done properly. But getting there is an uphill battle.

Considering the experience of your developers, I would recommend doing it in Razor Pages or MVC and gradually introducing bits of Angular/React code to areas of the front end that require enhancements.

In other words, do the whole thing in Razor Pages/MVC, pick a small area, branch the middleware pipeline and serve a small Angular app.

Malonis answered 3/6, 2019 at 6:24 Comment(3)
No duplication of logic if you use Blazor. Your recommendation of starting with Razor Pages because one "can directly port C# code to Blazor later on when it's stable" is wrong... Though Razor Pages and Razor Components (Blazor) employ Razor syntax and use C#, they are fundamentally different things, and you really cannot directly port from one to the other. Coding in Blazor requires you to be proficient in Blazor Component Model, and this is attainable after long period of learning, though its learning curve is less than that of, say, Angular.Grout
Don't comment on mine Isaac, my answer has nothing to do with Blazor, I don't know I read through the Blazor docs, things seem pretty similar. I'm looking at the ComponentModel it looks pretty much identical to React (maybe close to Vue, but they are all the same with minor differences). Shouldn't be a problem porting Pages to Blazor. It's definitely easier than porting Angular to Blazor....Malonis
I used the word "directly port" to mean, "there are some lines that you can copy and paste because they are both in razor syntax" not to mean you can rename .cshtml to .blazor and get away with itMalonis
B
6

Since most of your app is simple CRUD, consider using just razor/MVC.

Use Visual Studio + ASP.NET core + EF Core to automatically reverse engineer the database into models and database context. Then automatically generate (scaffold) the controllers and views for all CRUD operations. Sprinkle additional data annotations where needed.

And where you need more advanced data display/interaction (e.g. Grid, Calendar, ...) consider 3rd-party Javascript widgets. They don't require JavaScript expertise.

Ba answered 3/6, 2019 at 19:7 Comment(0)
B
2

Depends on your needs. Your company is full of C# developers so going to angular will increase the time and complexity of a project. Also since this is a web application that is meant for data entry in a corporate enviroment you don't care about loading times and optimization as much as you would in a commercial application. Generally try to develop using a ASP.NET Core framework with razor, and try to move to angular with a smaller project. That is my opinion. You want to deliver a technical solution that fits the needs of your company and keep development cost down, this should be the main axis that you make choices.

Belda answered 3/6, 2019 at 6:24 Comment(0)
C
2

For enterprise developer, I think we are more focus on business logic layer rather than UI design like SAP ABAP development that UI is generated by framework or library. I prefer to use strong type no matter front end or back end. It saves a lot of time and avoid typo bugs especially team development.

For example, a Sales Order input screen like below, we just need to create model with attributes and do configuration. The library will generated input and search screen.

  1. Model

Model

  1. Input screen

Input screen

  1. Search configuration

Search configuration

  1. Search screen

enter image description here

Continually answered 21/1, 2020 at 1:57 Comment(4)
What library is that?Gratuitous
@VladimirPanchenko It is developed by our team. It helps to minimize UI works and no of bugs.Continually
Is it publicly available as a commercial or open-source product?Gratuitous
It is an commercial product and the company provides consulting service. This is the demo link. You can send email to company.Continually
I
1

I am building an Core 3.1 Web.App right know with Razor. Works great, productivaty is very high. I am a very experienced Javascript developer with Angular experience. I like the mature Razor environment best. Authentication on the server is simple to implement. If you don't need a SPA but MPA then may be its best to stick with Razor. The loading of Views is not a problem with MVC, yes its slower as Angular but not noticable as long as you keep your views compact.

Influent answered 19/12, 2019 at 10:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.