Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Announcement] Upgrading to Serenity.Net 5 #5329

Closed
volkanceylan opened this issue Jan 1, 2021 · 8 comments
Closed

[Announcement] Upgrading to Serenity.Net 5 #5329

volkanceylan opened this issue Jan 1, 2021 · 8 comments

Comments

@volkanceylan
Copy link
Member

volkanceylan commented Jan 1, 2021

Introduction

Serenity 5 is a major update to Serenity Framework. It only supports .NET 5 and ASP.NET Core 5. For those who missed the news, .NET 5 is actually .NET Core 5, and is simply called .NET now. They skipped version 4 to avoid confusion with legacy .NET Framework 4.

From now on there will be only an .NET 5 / ASP.NET Core 5 version of Serenity / Serene and StartSharp. As announced about six months ago (#5060) we are no longer supporting .ASP.NET MVC or .NET Framework 4.5. There is a v3 branch in Serenity, Serene and StartSharp repositories but we will not be releasing any new versions there unless we find a critical security issue or similar. Anyway if we release a version there, it will be 3.x not 5.x.

Background

When we first released .NET Core version of Serenity initial target was to provide easy migration and code compability between ASP.NET MVC and ASP.NET Core templates, so that we could easily share code between two. For example, if we added a new sample to ASP.NET MVC, it had to be easily portable to .NET Core version with as few changes as possible. At that time, .NET Core itself was at its early stages, had some issues, missed some features and was not so stable. So the main branch of development for Serenity was still ASP.NET MVC. This changed in the last year, as we started to develop new features in .NET Core and ported them back to .NET MVC afterwards. Also, most of our customers we directly worked, ported their projects to .NET Core.

As the initial target was compability between two, we could not use some features of .NET Core like, primary one being dependency injection at the start. By time it became a pain source, as it is very important for testability and integration with the .NET Core platform itself.

List of Changes

We decided to completely embrace .NET Core / ASP.NET Core features, and use them instead of the ones in Serenity where possible, so there are many changes:

  • Removed "Dependency" class which was a service locator abstraction, and used Dependency Injection (DI) instead (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0)
  • Removed Config class and used Options pattern where possible (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0)
  • There is almost no static classes / state in Serenity framework now
  • Replaced "ILocalCache" interface with .NET Core's "IMemoryCache"
  • Replaced Serenity specific "IDistributedCache" interface and their implementations Serenity.Caching.Redis / Serenity.Caching.Couchbase with .NET Core's "IDistributedCache"
  • Removed "IAuthenticationService" interface and "AuthenticationService" static class, introduced an injectable "IUserAccessor" abstraction
  • Removed Serenity specific "Log" class, and used .NET Core's own logging system
  • Replaced ExtensibilityHelper.SelfAssemblies with a ITypeSource abstraction
  • Replaced static SqlConnections with ISqlConnections abstraction, it is now theorically possible to use dynamic connection strings per request (multi tenancy++)
  • Use DI with lookup scripts, data scripts etc.
  • Introduced IRequestContext for service handlers
  • Row base class is replaced with IRow interface, and there is a generic Row< TFields > base class with access to its Fields type
  • Rows can theorically have different set of custom fields and attributes per request (multi tenancy++)
  • Service behaviors rewritten for DI and they can get constructor injection
  • Script/CSS bundling use options pattern, and bundles can be specified at runtime, also IFileProvider of .NET used so non-physical files can be included in bundles.
  • Default sql dialect can be set per async context
  • Redesigned upload system, opens way to use different storage providers like Azure, S3 etc.
  • Rewrote core script library with modular typescript

This is not a complete list but should provide an overall idea.

Serenity 5 Packages

The Serenity 5 packages are prefixed with ".Net", to prevent confusion with v3 packages, and also to avoid users who still use v3 or ASP.NET projects to upgrade by mistake. Here is a list of Serenity 5 packages, and their original names in v3:

  • Serenity.Net.Core (formerly Serenity.Core)
  • Serenity.Net.Data (formerly Serenity.Data)
  • Serenity.Net.Entities (formerly Serenity.Data.Entities)
  • Serenity.Net.Services (formerly Serenity.Services)
  • Serenity.Net.Web (formerly Serenity.Web or Serenity.Web.AspNetCore)
  • Serenity.Scripts (this is not renamed yet as it is a static content package, they are compatible for now but stay at v3 version of Serenity.Scripts if you use 3.x)
  • Serenity.Assets (formerly Serenity.Web.Assets)

Upgrading to Serenity 5

The recommended way to use Serenity 5 / .NET 5 is to download latest Serene/StartSharp template, and create a new project.

For existing projects that you want to port to .NET 5, you'll need to follow steps outlined in:

If you haven't yet migrated your project to .NET Core, first follow steps here:
https://serenity.is/docs/migration/mvc-to-core

For StartSharp customers, who recently created a project using the prior 3.14.5.6 (or a recent one) we prepared a tool called stargen to make migration easier.

See this document for information on stargen and using it to migrate your project:

https://serenity.is/docs/migration/stargen

@volkanceylan volkanceylan pinned this issue Jan 1, 2021
@minhhungit
Copy link
Contributor

This release is gift for new year, big gift. Thank you Volkan and happy new year all 🎉

@kilroyFR
Copy link

kilroyFR commented Jan 1, 2021

Totally agree, the amount of work is very impressive. Thanks and happy new year !

@reach2rv
Copy link

reach2rv commented Jan 2, 2021

Thanks @volkanceylan for your efforts and support.. Happy New Year 🎉

@rcruzfalcon
Copy link

Thanks @volkanceylan for this great framework. Happy New Year.

@ysaadh
Copy link

ysaadh commented Jan 2, 2021

Thank you @volkanceylan , Happy new year.
Actually Serenity is the most beautiful framework I've ever seen. 👍

@kilroyFR
Copy link

kilroyFR commented Jan 4, 2021

Only one question Volkan, i noticed most libraries are targeted .netStandard 2.1.
Is there a plan to build them targeting only Net5 (short/medium/long term) or keeping them netStandard (i actually have same kind of interrogations for others of my projects - tempted to keep existing migrated NetStandard 2.1 and forgetting about swtiching to Net5 for these libs).
Thanks for any info.

@minhhungit
Copy link
Contributor

btw in this year I wish our community can have a page on wiki for Serenity Style Guide, I trust that it will help a lot 👍

@volkanceylan
Copy link
Member Author

@kilroyFR there is no need to target NET5 for base libraries, only web related ones and tools needs to be NET5.

@serenity-is serenity-is locked and limited conversation to collaborators May 25, 2021
@volkanceylan volkanceylan unpinned this issue Nov 18, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants