This repository has been archived by the owner on Jun 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from umco/develop
Preparing for v0.5.0 release
- Loading branch information
Showing
23 changed files
with
393 additions
and
363 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,24 +1,39 @@ | ||
using Umbraco.Core; | ||
using Umbraco.Core.Events; | ||
using Umbraco.Core.Models; | ||
using Umbraco.Core.Services; | ||
using System; | ||
using Newtonsoft.Json; | ||
using Our.Umbraco.NestedContent.Helpers; | ||
using Umbraco.Core; | ||
using Umbraco.Core.Cache; | ||
using Umbraco.Core.Sync; | ||
using Umbraco.Web.Cache; | ||
|
||
namespace Our.Umbraco.NestedContent | ||
{ | ||
public class Bootstrap : ApplicationEventHandler | ||
{ | ||
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | ||
{ | ||
DataTypeService.Saved += ExpireCache; | ||
CacheRefresherBase<DataTypeCacheRefresher>.CacheUpdated += DataTypeCacheRefresher_Updated; | ||
} | ||
|
||
private void ExpireCache(IDataTypeService sender, SaveEventArgs<IDataTypeDefinition> e) | ||
private void DataTypeCacheRefresher_Updated(DataTypeCacheRefresher sender, CacheRefresherEventArgs e) | ||
{ | ||
foreach (var dataType in e.SavedEntities) | ||
if (e.MessageType == MessageType.RefreshByJson) | ||
{ | ||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem( | ||
string.Concat("Our.Umbraco.NestedContent.GetPreValuesCollectionByDataTypeId_", dataType.Id)); | ||
var payload = JsonConvert.DeserializeObject<JsonPayload[]>((string)e.MessageObject); | ||
if (payload != null) | ||
{ | ||
foreach (var item in payload) | ||
{ | ||
NestedContentHelper.ClearCache(item.Id); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private class JsonPayload | ||
{ | ||
public Guid UniqueId { get; set; } | ||
public int Id { get; set; } | ||
} | ||
} | ||
} |
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
7 changes: 0 additions & 7 deletions
7
src/Our.Umbraco.NestedContent/Extensions/ContentTypeServiceExtensions.cs
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
src/Our.Umbraco.NestedContent/Extensions/JsonExtensions.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace Our.Umbraco.NestedContent.Extensions | ||
{ | ||
internal static class JsonExtensions | ||
{ | ||
public static void Rename(this JToken token, string newName) | ||
{ | ||
var parent = token.Parent; | ||
|
||
if (parent == null) | ||
throw new InvalidOperationException("The parent is missing."); | ||
|
||
var newToken = new JProperty(newName, token); | ||
parent.Replace(newToken); | ||
} | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
src/Our.Umbraco.NestedContent/Extensions/PreValueCollectionExtensions.cs
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.