-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add As/Put method to ISite to allow caching (#14372)
- Loading branch information
1 parent
aa1e1bd
commit 3f0242f
Showing
11 changed files
with
109 additions
and
35 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
src/OrchardCore.Modules/OrchardCore.Media/Processing/MediaTokenOptionsConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 36 additions & 20 deletions
56
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Settings/ISite.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
using Microsoft.AspNetCore.Routing; | ||
using OrchardCore.Entities; | ||
|
||
namespace OrchardCore.Settings | ||
namespace OrchardCore.Settings; | ||
|
||
public interface ISite : IEntity | ||
{ | ||
public interface ISite : IEntity | ||
{ | ||
string SiteName { get; set; } | ||
string PageTitleFormat { get; set; } | ||
string SiteSalt { get; set; } | ||
string SuperUser { get; set; } | ||
string Calendar { get; set; } | ||
string TimeZoneId { get; set; } | ||
ResourceDebugMode ResourceDebugMode { get; set; } | ||
bool UseCdn { get; set; } | ||
string CdnBaseUrl { get; set; } | ||
int PageSize { get; set; } | ||
int MaxPageSize { get; set; } | ||
int MaxPagedCount { get; set; } | ||
string BaseUrl { get; set; } | ||
RouteValueDictionary HomeRoute { get; set; } | ||
bool AppendVersion { get; set; } | ||
CacheMode CacheMode { get; set; } | ||
} | ||
string SiteName { get; set; } | ||
|
||
string PageTitleFormat { get; set; } | ||
|
||
string SiteSalt { get; set; } | ||
|
||
string SuperUser { get; set; } | ||
|
||
string Calendar { get; set; } | ||
|
||
string TimeZoneId { get; set; } | ||
|
||
ResourceDebugMode ResourceDebugMode { get; set; } | ||
|
||
bool UseCdn { get; set; } | ||
|
||
string CdnBaseUrl { get; set; } | ||
|
||
int PageSize { get; set; } | ||
|
||
int MaxPageSize { get; set; } | ||
|
||
int MaxPagedCount { get; set; } | ||
|
||
string BaseUrl { get; set; } | ||
|
||
RouteValueDictionary HomeRoute { get; set; } | ||
|
||
bool AppendVersion { get; set; } | ||
|
||
CacheMode CacheMode { get; set; } | ||
|
||
T As<T>() where T : new(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using OrchardCore.Settings; | ||
|
||
namespace OrchardCore.Tests.Utilities; | ||
|
||
public class SiteMockHelper | ||
{ | ||
public static Mock<ISite> GetSite<T>(T obj) where T : new() | ||
{ | ||
var properties = new JObject | ||
{ | ||
[obj.GetType().Name] = JObject.FromObject(obj) | ||
}; | ||
|
||
var mockSite = new Mock<ISite>(); | ||
mockSite.Setup(x => x.Properties) | ||
.Returns(properties); | ||
|
||
mockSite.Setup(x => x.As<T>()) | ||
.Returns(obj); | ||
|
||
return mockSite; | ||
} | ||
} |