Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Commit b1afdfc

Browse files
committed
Updated to .NET6 / Cofoundry v0.11
1 parent 990879e commit b1afdfc

File tree

10 files changed

+102
-157
lines changed

10 files changed

+102
-157
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: '{build}'
2-
image: Visual Studio 2019
2+
image: Visual Studio 2022
33
build_script:
44
- cmd: PowerShell .\build.ps1 --PushPackages="true"
55
test: off
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
56
<MvcRazorExcludeViewFilesFromPublish>false</MvcRazorExcludeViewFilesFromPublish>
67
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
78
</PropertyGroup>
89

910
<ItemGroup>
10-
<PackageReference Include="Cofoundry.Plugins.Imaging.SkiaSharp" Version="0.4.0" />
11-
<PackageReference Include="Cofoundry.Plugins.ErrorLogging.Admin" Version="0.10.0" />
12-
<PackageReference Include="Cofoundry.Plugins.SiteMap" Version="0.10.0" />
13-
<PackageReference Include="Cofoundry.Web.Admin" Version="0.10.3" />
11+
<PackageReference Include="Cofoundry.Plugins.Imaging.SkiaSharp" Version="0.5.0" />
12+
<PackageReference Include="Cofoundry.Plugins.ErrorLogging.Admin" Version="0.11.0" />
13+
<PackageReference Include="Cofoundry.Plugins.SiteMap" Version="0.11.0" />
14+
<PackageReference Include="Cofoundry.Web.Admin" Version="0.11.1" />
1415
</ItemGroup>
1516

1617
</Project>
Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,61 @@
1-
using Cofoundry.Domain;
2-
3-
namespace Cofoundry.Templates.Web
1+
namespace Cofoundry.Templates.Web;
2+
3+
/// <summary>
4+
/// An example custom entity definition.
5+
/// See https://www.cofoundry.org/docs/content-management/custom-entities
6+
/// for more information
7+
/// </summary>
8+
public class ProductCustomEntityDefinition : ICustomEntityDefinition<ProductDataModel>
49
{
510
/// <summary>
6-
/// An example custom entity definition.
7-
/// See https://www.cofoundry.org/docs/content-management/custom-entities
8-
/// for more information
11+
/// This constant is a convention that allows us to reference this definition code
12+
/// in other parts of the application (e.g. querying)
913
/// </summary>
10-
public class ProductCustomEntityDefinition : ICustomEntityDefinition<ProductDataModel>
11-
{
12-
/// <summary>
13-
/// This constant is a convention that allows us to reference this definition code
14-
/// in other parts of the application (e.g. querying)
15-
/// </summary>
16-
public const string DefinitionCode = "EXAPRD";
14+
public const string DefinitionCode = "EXAPRD";
1715

18-
/// <summary>
19-
/// Unique 6 letter code representing the entity (the convention is to use uppercase)
20-
/// </summary>
21-
public string CustomEntityDefinitionCode => DefinitionCode;
16+
/// <summary>
17+
/// Unique 6 letter code representing the entity (the convention is to use uppercase)
18+
/// </summary>
19+
public string CustomEntityDefinitionCode => DefinitionCode;
2220

23-
/// <summary>
24-
/// Singlar name of the entity
25-
/// </summary>
26-
public string Name => "Product";
21+
/// <summary>
22+
/// Singlar name of the entity
23+
/// </summary>
24+
public string Name => "Product";
2725

28-
/// <summary>
29-
/// Plural name of the entity
30-
/// </summary>
31-
public string NamePlural => "Products";
26+
/// <summary>
27+
/// Plural name of the entity
28+
/// </summary>
29+
public string NamePlural => "Products";
3230

33-
/// <summary>
34-
/// A short description that shows up as a tooltip for the admin
35-
/// module.
36-
/// </summary>
37-
public string Description => "An example custom entity type.";
31+
/// <summary>
32+
/// A short description that shows up as a tooltip for the admin
33+
/// module.
34+
/// </summary>
35+
public string Description => "An example custom entity type.";
3836

39-
/// <summary>
40-
/// Indicates whether the UrlSlug property should be treated
41-
/// as a unique property and be validated as such.
42-
/// </summary>
43-
public bool ForceUrlSlugUniqueness => true;
37+
/// <summary>
38+
/// Indicates whether the UrlSlug property should be treated
39+
/// as a unique property and be validated as such.
40+
/// </summary>
41+
public bool ForceUrlSlugUniqueness => true;
4442

45-
/// <summary>
46-
/// Indicates whether the url slug should be autogenerated. If this
47-
/// is selected then the user will not be shown the UrlSlug property
48-
/// and it will be auto-generated based on the title.
49-
/// </summary>
50-
public bool AutoGenerateUrlSlug => true;
43+
/// <summary>
44+
/// Indicates whether the url slug should be autogenerated. If this
45+
/// is selected then the user will not be shown the UrlSlug property
46+
/// and it will be auto-generated based on the title.
47+
/// </summary>
48+
public bool AutoGenerateUrlSlug => true;
5149

52-
/// <summary>
53-
/// Indicates whether this custom entity should always be published when
54-
/// saved, provided the user has permissions to do so. Useful if this isn't
55-
/// the sort of entity that needs a draft state workflow
56-
/// </summary>
57-
public bool AutoPublish => false;
50+
/// <summary>
51+
/// Indicates whether this custom entity should always be published when
52+
/// saved, provided the user has permissions to do so. Useful if this isn't
53+
/// the sort of entity that needs a draft state workflow
54+
/// </summary>
55+
public bool AutoPublish => false;
5856

59-
/// <summary>
60-
/// Indicates whether the entities are partitioned by locale
61-
/// </summary>
62-
public bool HasLocale => false;
63-
}
57+
/// <summary>
58+
/// Indicates whether the entities are partitioned by locale
59+
/// </summary>
60+
public bool HasLocale => false;
6461
}
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
using Cofoundry.Domain;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.ComponentModel.DataAnnotations;
5-
using System.Linq;
1+
using System.ComponentModel.DataAnnotations;
62

7-
namespace Cofoundry.Templates.Web
3+
namespace Cofoundry.Templates.Web;
4+
5+
public class ProductDataModel : ICustomEntityDataModel
86
{
9-
public class ProductDataModel : ICustomEntityDataModel
10-
{
11-
[MaxLength(500)]
12-
[Display(Description = "A short description of the product.")]
13-
[MultiLineText]
14-
public string ShortDescription { get; set; }
15-
}
7+
[MaxLength(500)]
8+
[Display(Description = "A short description of the product.")]
9+
[MultiLineText]
10+
public string ShortDescription { get; set; }
1611
}
Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
using Cofoundry.Domain;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.ComponentModel.DataAnnotations;
5-
using System.Linq;
1+
using System.ComponentModel.DataAnnotations;
62

7-
namespace Cofoundry.Templates.Web
3+
namespace Cofoundry.Templates.Web;
4+
5+
/// <summary>
6+
/// An example page block type.
7+
/// See https://www.cofoundry.org/docs/content-management/page-block-types
8+
/// for more information
9+
/// </summary>
10+
public class ContentSectionDataModel : IPageBlockTypeDataModel, IPageBlockTypeDisplayModel
811
{
9-
/// <summary>
10-
/// An example page block type.
11-
/// See https://www.cofoundry.org/docs/content-management/page-block-types
12-
/// for more information
13-
/// </summary>
14-
public class ContentSectionDataModel : IPageBlockTypeDataModel, IPageBlockTypeDisplayModel
15-
{
16-
[Display(Description = "Optional title to display at the top of the section")]
17-
public string Title { get; set; }
12+
[Display(Description = "Optional title to display at the top of the section")]
13+
public string Title { get; set; }
1814

19-
[Required]
20-
[Display(Name = "Text", Description = "Rich text displayed at full width")]
21-
[Html(HtmlToolbarPreset.BasicFormatting, HtmlToolbarPreset.Headings, HtmlToolbarPreset.Media)]
22-
public string HtmlText { get; set; }
23-
}
15+
[Required]
16+
[Display(Name = "Text", Description = "Rich text displayed at full width")]
17+
[Html(HtmlToolbarPreset.BasicFormatting, HtmlToolbarPreset.Headings, HtmlToolbarPreset.Media)]
18+
public string HtmlText { get; set; }
2419
}
Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore;
7-
using Microsoft.AspNetCore.Hosting;
1+
var builder = WebApplication.CreateBuilder(args);
2+
builder.WebHost.UseLocalConfigFile();
83

9-
namespace Cofoundry.Templates.Web
10-
{
11-
public class Program
12-
{
13-
public static void Main(string[] args)
14-
{
15-
CreateWebHostBuilder(args).Build().Run();
16-
}
4+
builder.Services
5+
.AddControllersWithViews()
6+
.AddCofoundry(builder.Configuration);
7+
8+
var app = builder.Build();
179

18-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
19-
WebHost.CreateDefaultBuilder(args)
20-
.UseStartup<Startup>();
21-
}
10+
if (!builder.Environment.IsDevelopment())
11+
{
12+
app.UseHsts();
2213
}
14+
15+
app.UseHttpsRedirection();
16+
app.UseCofoundry();
17+
18+
app.Run();

src/Cofoundry.Templates.Web/Startup.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
global using Cofoundry.Domain;
2+
global using Cofoundry.Web;
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
2+
"DetailedErrors": true,
23
"Logging": {
3-
"IncludeScopes": false,
44
"LogLevel": {
5-
"Default": "Debug",
6-
"System": "Information",
7-
"Microsoft": "Information"
5+
"Default": "Information",
6+
"Microsoft.AspNetCore": "Warning"
87
}
98
}
109
}

src/Cofoundry.Templates.Web/appsettings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"Logging": {
3-
"IncludeScopes": false,
43
"LogLevel": {
5-
"Default": "Warning"
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
66
}
77
},
8+
"AllowedHosts": "*",
89

910
"Cofoundry": {
1011
"Database:ConnectionString": "Server=.\\sqlexpress;Database=Cofoundry.Templates.Web;Integrated Security=True;MultipleActiveResultSets=True"

0 commit comments

Comments
 (0)