刷新:重新发现商业与未来
.NET生态系统将是惊人的一年: (It’s going to be an amazing year for the .NET ecosystem:)
- .NET Framework is “complete”. It’s not likely that there will be a new version of the framework. 4.8 will be the last one after 18 years. .NET Framework已完成。 该框架不太可能会有新版本。 4.8将是18年后的最后一个。
.NET Core 3.1 is an LTS (a Long Term Support version supported for three years after the initial release Dec 2019). This version of .NET Core will also be the last one. The most loved framework in 2019 is done, is it?
.NET Core 3.1是LTS( 长期支持版本,自最初发布2019年12月以来已获得三年支持)。 此版本的.NET Core也将是最后一个。 2019年最受欢迎的框架完成了,是吗?
So, why is this going to be a great year? .NET 5 will come, in November 2020, to cover all the cases. It will be the new framework to solve all the problems. It will take the best from .NET Framework, .NET Core, Xamarin and Mono including AoT compilation. You will be able to develop apps for Windows, Mac, Web, Mobile, Cloud, IoT, Gaming, Machine Learning and Data Science. Of course, you will be able to create all of this from the most loved development environment in 2019: Visual Studio Code. What’s more is; this will include a great support for containers even adapting its behaviour with CPU and memory limitations introduced by Docker.
那么,为什么今年会是一个伟大的一年呢? .NET 5将于2020年11月涵盖所有情况。 这将是解决所有问题的新框架。 它将充分利用.NET Framework,.NET Core,Xamarin和Mono(包括AoT编译)的优势。 您将能够为Windows,Mac,Web,移动,云,物联网,游戏,机器学习和数据科学开发应用程序。 当然,您将能够从2019年最受欢迎的开发环境Visual Studio Code中创建所有这些内容。 更重要的是; 这将包括对容器的强大支持,甚至通过Docker引入的CPU和内存限制来适应其行为。
我如何为公司做好准备以应对这一变化? (How do I prepare my company for this change?)
- If you are building something new, do it with .NET Core 3.1. 如果要构建新内容,请使用.NET Core 3.1。
If you are not using .NET at all, should you consider it? Do you want to use WebAssembly? Maybe it’s worth taking a look at Blazor. Similarly, the way to go about it could be with Rust (performance).
如果根本不使用.NET,应该考虑使用它吗? 您要使用WebAssembly吗? 也许值得一看Blazor 。 同样,可以通过Rust ( performance )实现此目的。
- If you have a .NET Framework app, you will have some work to do. 如果您具有.NET Framework应用程序,则需要完成一些工作。
从.NET框架迁移到.NET Core 3.1 (Migrating from .NET framework to .NET Core 3.1)
Analyze your architecture. As always, building good software will allow you to be prepared for future changes like this one. A good architecture will help you a lot in migrating things. For instance, you should have your logic isolated from your UI and this will allow you to move forward easier. If you don’t have software that is prepared for this, consider replacing it.
分析您的架构。 与往常一样,构建良好的软件将使您为将来的此类变化做好准备。 良好的体系结构将对您的迁移有所帮助。 例如,您应该将逻辑与UI隔离开来,这将使您更轻松地前进。 如果您没有为此准备的软件,请考虑更换它。
Analyze your situation: Use a Compatibility tool and check your dependencies status
分析您的情况:使用兼容性工具并检查您的依赖状态
Upgrade dependencies: You need your dependencies to support .NET Standard.
升级依赖关系:您需要依赖关系才能支持.NET Standard。
Migrate: Migrate your project files and config files to the new .NET Core structure (SDK-style). Choose the same folder and only open one of the projects at a time.
迁移:将项目文件和配置文件迁移到新的.NET Core结构(SDK样式)。 选择相同的文件夹,一次只能打开一个项目。
Move your logic to .NET standard: Start to change your not-UI libraries to use .NET standard. They will be compatible with both frameworks, until 2.0.
将您的逻辑移至.NET标准 :开始将非UI库更改为使用.NET标准。 它们将与两个框架兼容, 直到2.0为止 。
Analyze your UI: Remember that Winforms and WPF won’t be multiplatform. So, consider moving those to another tech. UWP (Universal Windows Platform) is a framework for PC, tablets, smartphones, Xbox, HoloLens, Surface Hub, and Windows 10 IoT Core. Maybe with WinUI?. Even if you want to stay and move forward with your old choice, you will discover some ground-breaking changes. It won’t be an easy movement. Consider moving to SPA (Angular, React, Vue, Blazor, etc). As always, consider using or buying a component library to boost your development speed and time-to-market.
分析您的UI :请记住,Winforms和WPF不会是多平台的。 因此,请考虑将其转移到另一技术。 UWP(通用Windows平台)是PC,平板电脑,智能手机,Xbox,HoloLens,Surface Hub和Windows 10 IoT核心版的框架。 也许与WinUI ?。 即使您希望留下来并继续您的旧选择,您也会发现一些突破性的变化 。 这将不是一件容易的事。 考虑迁移到SPA(Angular,React,Vue,Blazor等)。 与往常一样,请考虑使用或购买组件库以提高开发速度和上市时间。
Client-Server communication: Do you want to change it? Were you using Remoting or WCF? You can use REST, GraphQL, gRPC, Websockets, SignalR, and/or WebHooks.
客户端-服务器通信:是否要更改它? 您使用的是Remoting还是WCF? 您可以使用REST,GraphQL, gRPC , Websockets , SignalR和/或WebHooks。
Improve your code: use all the new features in .NET Core to improve your architecture
改进您的代码:使用.NET Core中的所有新功能来改进您的体系结构
用新的现代堆栈替换或转换应用程序 (Replacing or transforming the app with a new modern stack)
If you decide that your app is legacy and you need to build something new, I recommend avoiding a big bang change. Do it in small increments and release as often as possible. Here is how you can do this:
如果您确定自己的应用程序是旧版应用程序,并且需要构建一些新内容,则建议您避免发生重大变化。 以较小的增量执行该操作,并尽可能频繁地释放它。 这是您可以执行的操作:
In the backend, if you have a good architecture, you can use the strangler pattern. You can also create backend libraries with .NET Core and use them from your old Framework App while you migrate. For the UI, if you need to integrate two different technologies, use standards if possible. In this case, web components.
在后端,如果您有良好的体系结构,则可以使用扼杀器模式 。 您还可以使用.NET Core创建后端库,并在迁移时从旧的Framework App中使用它们。 对于UI,如果需要集成两种不同的技术,请尽可能使用标准。 在这种情况下,Web组件。
If you have an old .NET MVC app, you can develop a new SPA and expose these new components as web components. The registration of the web components will be available in both apps and you can create a communication mechanism between them:
如果您有旧的.NET MVC应用程序,则可以开发新的SPA并将这些新组件公开为Web组件。 Web组件的注册将在两个应用程序中都可用,您可以在它们之间创建通信机制:
- Native custom events 本机自定义事件
- Input/Output changes in web components Web组件中的输入/输出更改
- Advance communication between your UI apps, old MVC and new SPA, via reactive programming (Rxjs) 通过React式编程(Rxjs)促进UI应用程序,旧MVC和新SPA之间的通信
This will allow us not to generate new tech debt while changing the old components in an iterative way. Your customers will be enjoying your new SPA integrated with their old app from the very beginning. We will detail this approach in the next tech blog piece, using Angular as an example.
这将使我们在以迭代方式更改旧组件时不会产生新的技术债务。 您的客户从一开始就将享受与旧应用程序集成的新SPA。 我们将在下一个技术博客文章中以Angular为例详细介绍这种方法。
结论 (Conclusion)
If you want to keep evolving your app, you need to update your stack. You can continue, of course, creating your software in .NET Framework 4.8 but sooner or later, you will need to upgrade. Start your migration now. Want to go deeper? Interesting things to follow regarding .NET and WebAssembly future in .NET:
如果您想继续发展您的应用程序,则需要更新您的堆栈。 当然,您可以继续在.NET Framework 4.8中创建软件,但是迟早需要升级。 立即开始迁移。 想更深入吗? 有关.NET和.NET将来的WebAssembly未来的有趣事情:
翻译自: https://medium.com/swlh/net-prepare-your-company-for-the-future-zartis-491d30d93a9f
刷新:重新发现商业与未来