File tree Expand file tree Collapse file tree 5 files changed +53
-54
lines changed
src/Umbraco.AuthorizedServices Expand file tree Collapse file tree 5 files changed +53
-54
lines changed Original file line number Diff line number Diff line change 22using Microsoft . Extensions . DependencyInjection ;
33using Umbraco . AuthorizedServices . Configuration ;
44using Umbraco . AuthorizedServices . Manifests ;
5- using Umbraco . AuthorizedServices . Migrations ;
65using Umbraco . AuthorizedServices . Services ;
76using Umbraco . AuthorizedServices . Services . Implement ;
87using Umbraco . Cms . Core . Composing ;
98using Umbraco . Cms . Core . DependencyInjection ;
10- using Umbraco . Cms . Core . Notifications ;
119using Umbraco . Extensions ;
1210
1311namespace Umbraco . AuthorizedServices ;
@@ -47,7 +45,5 @@ public void Compose(IUmbracoBuilder builder)
4745 builder . Services . AddUnique < ITokenStorage , DatabaseTokenStorage > ( ) ;
4846
4947 builder . Services . AddSingleton < JsonSerializerFactory > ( ) ;
50-
51- builder . AddNotificationHandler < UmbracoApplicationStartingNotification , DatabaseMigrationHandler > ( ) ;
5248 }
5349}
Original file line number Diff line number Diff line change 1- using System . Diagnostics ;
1+ using System . Reflection ;
2+ using Umbraco . Cms . Core . Semver ;
3+ using Umbraco . Extensions ;
24
35namespace Umbraco . AuthorizedServices ;
46
57public static class Constants
68{
9+ internal const string PackageName = "Umbraco Authorized Services" ;
10+
711 public const string PluginName = "UmbracoAuthorizedServices" ;
812
913 public const string Separator = "-" ;
1014
11- public static readonly string InformationalVersion = FileVersionInfo . GetVersionInfo ( typeof ( Constants ) . Assembly . Location ) . ProductVersion ! ;
15+ public static readonly string InformationalVersion = GetInformationalVersion ( ) ;
16+
17+ private static string GetInformationalVersion ( )
18+ {
19+ Assembly assembly = typeof ( Constants ) . Assembly ;
20+ AssemblyInformationalVersionAttribute ? assemblyInformationalVersionAttribute = assembly . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ;
21+ if ( assemblyInformationalVersionAttribute is not null &&
22+ SemVersion . TryParse ( assemblyInformationalVersionAttribute . InformationalVersion , out SemVersion ? semVersion ) )
23+ {
24+ return semVersion ! . ToSemanticStringWithoutBuild ( ) ;
25+ }
26+ else
27+ {
28+ AssemblyName assemblyName = assembly . GetName ( ) ;
29+ if ( assemblyName . Version is not null )
30+ {
31+ return assemblyName . Version . ToString ( 3 ) ;
32+ }
33+ }
34+
35+ return string . Empty ;
36+ }
1237
1338 public static class Trees
1439 {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public void Filter(List<PackageManifest> manifests)
1010 {
1111 AllowPackageTelemetry = true ,
1212 Version = Constants . InformationalVersion ,
13- PackageName = "Umbraco Authorized Services" ,
13+ PackageName = Constants . PackageName ,
1414 BundleOptions = BundleOptions . None ,
1515 Scripts = new [ ]
1616 {
Original file line number Diff line number Diff line change 1+ using Umbraco . Cms . Core . Packaging ;
2+
3+ namespace Umbraco . AuthorizedServices . Migrations ;
4+
5+ /// <summary>
6+ /// Defines the migration plan for the Authorized Services package.
7+ /// </summary>
8+ public class AuthorizedServicesMigrationPlan : PackageMigrationPlan
9+ {
10+ /// <summary>
11+ /// Initializes a new instance of the <see cref="AuthorizedServicesMigrationPlan" /> class.
12+ /// </summary>
13+ public AuthorizedServicesMigrationPlan ( )
14+ : base ( Constants . PackageName , Constants . Migrations . MigrationPlan )
15+ { }
16+
17+ /// <inheritdoc />
18+ public override bool IgnoreCurrentState => false ;
19+
20+ /// <inheritdoc />
21+ protected override void DefinePlan ( )
22+ {
23+ To < AddDatabaseTokenStorageTable > ( Constants . Migrations . TargetState ) ;
24+ }
25+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments