Skip to content

Commit a556e41

Browse files
authored
Merge pull request #40 from cloudscribe/feature/698
#698
2 parents 1ec1d8b + 98a7bfb commit a556e41

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

src/cloudscribe.SimpleContactForm.CoreIntegration/StartupExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using cloudscribe.SimpleContactForm.CoreIntegration;
22
using cloudscribe.SimpleContactForm.Models;
3+
using cloudscribe.Versioning;
34
using Microsoft.Extensions.Configuration;
45
using Microsoft.Extensions.DependencyInjection.Extensions;
56

@@ -15,6 +16,8 @@ IConfiguration configuration
1516
services.TryAddScoped<ITenantResolver, CoreTenantResolver>();
1617
services.TryAddScoped<IContactFormResolver, SiteContactFormResolver>();
1718
services.TryAddScoped<IPrePopulateContactForm, FormPrepopulator>();
19+
services.AddScoped<IVersionProvider, VersionProvider>();
20+
services.AddScoped<IVersionProvider, cloudscribe.SimpleContactForm.VersionProvider>();
1821

1922
return services;
2023
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using cloudscribe.Versioning;
2+
using System;
3+
using System.Reflection;
4+
5+
namespace cloudscribe.SimpleContactForm.CoreIntegration
6+
{
7+
public class VersionProvider : IVersionProvider
8+
{
9+
private Assembly assembly = typeof(CoreTenantResolver).Assembly;
10+
11+
public string Name
12+
{
13+
get { return assembly.GetName().Name; }
14+
15+
}
16+
17+
public Guid ApplicationId { get { return new Guid("fs5r3f82-5n38-4c83-93c8-cc4c303209ed"); } }
18+
19+
public Version CurrentVersion
20+
{
21+
22+
get
23+
{
24+
25+
var version = new Version(2, 0, 0, 0);
26+
var versionString = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
27+
if (!string.IsNullOrWhiteSpace(versionString))
28+
{
29+
Version.TryParse(versionString, out version);
30+
}
31+
32+
return version;
33+
}
34+
}
35+
}
36+
}

src/cloudscribe.SimpleContactForm/StartupExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public static IServiceCollection AddCloudscribeSimpleContactForm(
2626
services.Configure<ContactFormMessageOptions>(configuration.GetSection("ContactFormMessageOptions"));
2727
services.Configure<ContactFormSettings>(configuration.GetSection("ContactFormSettings"));
2828

29-
3029
services.TryAddScoped<IRecaptchaKeysProvider, ConfigRecaptchaKeysProvider>();
3130
services.AddScoped<ContactFormService, ContactFormService>();
3231

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using cloudscribe.SimpleContactForm.ViewModels;
2+
using cloudscribe.Versioning;
3+
using System;
4+
using System.Reflection;
5+
6+
namespace cloudscribe.SimpleContactForm
7+
{
8+
public class VersionProvider : IVersionProvider
9+
{
10+
private Assembly assembly = typeof(MessageViewModel).Assembly;
11+
12+
public string Name
13+
{
14+
get { return assembly.GetName().Name; }
15+
16+
}
17+
18+
public Guid ApplicationId { get { return new Guid("fs5r3f82-4b27-4c83-93c8-cc4c303209ed"); } }
19+
20+
public Version CurrentVersion
21+
{
22+
23+
get
24+
{
25+
26+
var version = new Version(2, 0, 0, 0);
27+
var versionString = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
28+
if (!string.IsNullOrWhiteSpace(versionString))
29+
{
30+
Version.TryParse(versionString, out version);
31+
}
32+
33+
return version;
34+
}
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)