Merge branch '6.2.0' into 6.2.0-pubcontent

This commit is contained in:
Stephan
2013-09-18 10:56:07 +02:00
28 changed files with 2105 additions and 1585 deletions

View File

@@ -120,67 +120,7 @@ namespace Umbraco.Core.Models
return result;
}
/// <summary>
/// Indicates whether a specific property on the current <see cref="IContent"/> entity is dirty.
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>True if Property is dirty, otherwise False</returns>
public override bool IsPropertyDirty(string propertyName)
{
bool existsInEntity = base.IsPropertyDirty(propertyName);
bool anyDirtyGroups = PropertyGroups.Any(x => x.IsPropertyDirty(propertyName));
bool anyDirtyTypes = PropertyTypes.Any(x => x.IsPropertyDirty(propertyName));
return existsInEntity || anyDirtyGroups || anyDirtyTypes;
}
/// <summary>
/// Indicates whether the current entity is dirty.
/// </summary>
/// <returns>True if entity is dirty, otherwise False</returns>
public override bool IsDirty()
{
bool dirtyEntity = base.IsDirty();
bool dirtyGroups = PropertyGroups.Any(x => x.IsDirty());
bool dirtyTypes = PropertyTypes.Any(x => x.IsDirty());
return dirtyEntity || dirtyGroups || dirtyTypes;
}
/// <summary>
/// Resets dirty properties by clearing the dictionary used to track changes.
/// </summary>
/// <remarks>
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
public override void ResetDirtyProperties()
{
base.ResetDirtyProperties();
//loop through each property group to reset the property types
var propertiesReset = new List<int>();
foreach (var propertyGroup in PropertyGroups)
{
propertyGroup.ResetDirtyProperties();
foreach (var propertyType in propertyGroup.PropertyTypes)
{
propertyType.ResetDirtyProperties();
propertiesReset.Add(propertyType.Id);
}
}
//then loop through our property type collection since some might not exist on a property group
//but don't re-reset ones we've already done.
foreach (var propertyType in PropertyTypes.Where(x => propertiesReset.Contains(x.Id) == false))
{
propertyType.ResetDirtyProperties();
}
}
/// <summary>
/// Creates a clone of the current entity
/// </summary>

View File

@@ -503,5 +503,65 @@ namespace Umbraco.Core.Models
{
get { return _propertyTypes; }
}
/// <summary>
/// Indicates whether a specific property on the current <see cref="IContent"/> entity is dirty.
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>True if Property is dirty, otherwise False</returns>
public override bool IsPropertyDirty(string propertyName)
{
bool existsInEntity = base.IsPropertyDirty(propertyName);
bool anyDirtyGroups = PropertyGroups.Any(x => x.IsPropertyDirty(propertyName));
bool anyDirtyTypes = PropertyTypes.Any(x => x.IsPropertyDirty(propertyName));
return existsInEntity || anyDirtyGroups || anyDirtyTypes;
}
/// <summary>
/// Indicates whether the current entity is dirty.
/// </summary>
/// <returns>True if entity is dirty, otherwise False</returns>
public override bool IsDirty()
{
bool dirtyEntity = base.IsDirty();
bool dirtyGroups = PropertyGroups.Any(x => x.IsDirty());
bool dirtyTypes = PropertyTypes.Any(x => x.IsDirty());
return dirtyEntity || dirtyGroups || dirtyTypes;
}
/// <summary>
/// Resets dirty properties by clearing the dictionary used to track changes.
/// </summary>
/// <remarks>
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
public override void ResetDirtyProperties()
{
base.ResetDirtyProperties();
//loop through each property group to reset the property types
var propertiesReset = new List<int>();
foreach (var propertyGroup in PropertyGroups)
{
propertyGroup.ResetDirtyProperties();
foreach (var propertyType in propertyGroup.PropertyTypes)
{
propertyType.ResetDirtyProperties();
propertiesReset.Add(propertyType.Id);
}
}
//then loop through our property type collection since some might not exist on a property group
//but don't re-reset ones we've already done.
foreach (var propertyType in PropertyTypes.Where(x => propertiesReset.Contains(x.Id) == false))
{
propertyType.ResetDirtyProperties();
}
}
}
}