Merge branch origin/temp8 into temp8-di2690

This commit is contained in:
Stephan
2018-12-10 17:49:11 +01:00
74 changed files with 1085 additions and 666 deletions

View File

@@ -92,8 +92,8 @@ namespace Umbraco.Core.Models
public readonly PropertyInfo AllowedAsRootSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.AllowedAsRoot);
public readonly PropertyInfo IsContainerSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.IsContainer);
public readonly PropertyInfo AllowedContentTypesSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, IEnumerable<ContentTypeSort>>(x => x.AllowedContentTypes);
public readonly PropertyInfo PropertyGroupCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, PropertyGroupCollection>(x => x.PropertyGroups);
public readonly PropertyInfo PropertyTypeCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, IEnumerable<PropertyType>>(x => x.PropertyTypes);
public readonly PropertyInfo PropertyGroupsSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, PropertyGroupCollection>(x => x.PropertyGroups);
public readonly PropertyInfo PropertyTypesSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, IEnumerable<PropertyType>>(x => x.PropertyTypes);
public readonly PropertyInfo HasPropertyTypeBeenRemovedSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, bool>(x => x.HasPropertyTypeBeenRemoved);
public readonly PropertyInfo VaryBy = ExpressionHelper.GetPropertyInfo<ContentTypeBase, ContentVariation>(x => x.Variations);
@@ -106,12 +106,12 @@ namespace Umbraco.Core.Models
protected void PropertyGroupsChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertyGroupCollectionSelector);
OnPropertyChanged(Ps.Value.PropertyGroupsSelector);
}
protected void PropertyTypesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertyTypeCollectionSelector);
OnPropertyChanged(Ps.Value.PropertyTypesSelector);
}
/// <summary>
@@ -263,6 +263,8 @@ namespace Umbraco.Core.Models
get => _noGroupPropertyTypes;
set
{
if (_noGroupPropertyTypes != null)
_noGroupPropertyTypes.CollectionChanged -= PropertyTypesChanged;
_noGroupPropertyTypes = new PropertyTypeCollection(IsPublishing, value);
_noGroupPropertyTypes.CollectionChanged += PropertyTypesChanged;
PropertyTypesChanged(_noGroupPropertyTypes, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
@@ -376,7 +378,7 @@ namespace Umbraco.Core.Models
if (!HasPropertyTypeBeenRemoved)
{
HasPropertyTypeBeenRemoved = true;
OnPropertyChanged(Ps.Value.PropertyTypeCollectionSelector);
OnPropertyChanged(Ps.Value.PropertyTypesSelector);
}
break;
}
@@ -388,7 +390,7 @@ namespace Umbraco.Core.Models
if (!HasPropertyTypeBeenRemoved)
{
HasPropertyTypeBeenRemoved = true;
OnPropertyChanged(Ps.Value.PropertyTypeCollectionSelector);
OnPropertyChanged(Ps.Value.PropertyTypesSelector);
}
}
}
@@ -412,7 +414,7 @@ namespace Umbraco.Core.Models
// actually remove the group
PropertyGroups.RemoveItem(propertyGroupName);
OnPropertyChanged(Ps.Value.PropertyGroupCollectionSelector);
OnPropertyChanged(Ps.Value.PropertyGroupsSelector);
}
/// <summary>

View File

@@ -35,12 +35,12 @@ namespace Umbraco.Core.Models
{
public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, string>(x => x.Name);
public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, int>(x => x.SortOrder);
public readonly PropertyInfo PropertyTypeCollectionSelector = ExpressionHelper.GetPropertyInfo<PropertyGroup, PropertyTypeCollection>(x => x.PropertyTypes);
public readonly PropertyInfo PropertyTypes = ExpressionHelper.GetPropertyInfo<PropertyGroup, PropertyTypeCollection>(x => x.PropertyTypes);
}
private void PropertyTypesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
OnPropertyChanged(Ps.Value.PropertyTypeCollectionSelector);
OnPropertyChanged(Ps.Value.PropertyTypes);
}
/// <summary>
@@ -76,6 +76,8 @@ namespace Umbraco.Core.Models
get => _propertyTypes;
set
{
if (_propertyTypes != null)
_propertyTypes.CollectionChanged -= PropertyTypesChanged;
_propertyTypes = value;
// since we're adding this collection to this group,
@@ -83,6 +85,7 @@ namespace Umbraco.Core.Models
foreach (var propertyType in _propertyTypes)
propertyType.PropertyGroupId = new Lazy<int>(() => Id);
OnPropertyChanged(Ps.Value.PropertyTypes);
_propertyTypes.CollectionChanged += PropertyTypesChanged;
}
}

View File

@@ -190,8 +190,8 @@ AND umbracoNode.nodeObjectType = @objectType",
SortOrder = allowedContentType.SortOrder
});
}
//Insert Tabs
foreach (var propertyGroup in entity.PropertyGroups)
{
@@ -328,14 +328,14 @@ AND umbracoNode.id <> @id",
// We check if the entity's own PropertyTypes has been modified and then also check
// any of the property groups PropertyTypes has been modified.
// This specifically tells us if any property type collections have changed.
if (entity.IsPropertyDirty("PropertyTypes") || entity.PropertyGroups.Any(x => x.IsPropertyDirty("PropertyTypes")))
if (entity.IsPropertyDirty("NoGroupPropertyTypes") || entity.PropertyGroups.Any(x => x.IsPropertyDirty("PropertyTypes")))
{
var dbPropertyTypes = Database.Fetch<PropertyTypeDto>("WHERE contentTypeId = @Id", new { entity.Id });
var dbPropertyTypeAlias = dbPropertyTypes.Select(x => x.Id);
var dbPropertyTypeIds = dbPropertyTypes.Select(x => x.Id);
var entityPropertyTypes = entity.PropertyTypes.Where(x => x.HasIdentity).Select(x => x.Id);
var items = dbPropertyTypeAlias.Except(entityPropertyTypes);
foreach (var item in items)
DeletePropertyType(entity.Id, item);
var propertyTypeToDeleteIds = dbPropertyTypeIds.Except(entityPropertyTypes);
foreach (var propertyTypeId in propertyTypeToDeleteIds)
DeletePropertyType(entity.Id, propertyTypeId);
}
// Delete tabs ... by excepting entries from db with entries from collections.
@@ -620,7 +620,7 @@ AND umbracoNode.id <> @id",
var sqlDelete = Sql()
.Delete<RedirectUrlDto>()
.WhereIn((System.Linq.Expressions.Expression<Func<RedirectUrlDto, object>>)(x => x.ContentKey), sqlSelect);
Database.Execute(sqlDelete);
}
@@ -690,7 +690,7 @@ AND umbracoNode.id <> @id",
//first clear out any existing names that might already exists under the default lang
//there's 2x tables to update
//clear out the versionCultureVariation table
//clear out the versionCultureVariation table
var sqlSelect = Sql().Select<ContentVersionCultureVariationDto>(x => x.Id)
.From<ContentVersionCultureVariationDto>()
.InnerJoin<ContentVersionDto>().On<ContentVersionDto, ContentVersionCultureVariationDto>(x => x.Id, x => x.VersionId)

View File

@@ -1030,7 +1030,7 @@ namespace Umbraco.Core.Services.Implement
scope.WriteLock(Constants.Locks.MemberTree);
var ids = _memberGroupRepository.GetMemberIds(usernames);
_memberGroupRepository.AssignRoles(ids, roleNames);
scope.Events.Dispatch(AssignedRoles, this, new RolesEventArgs(ids, roleNames));
scope.Events.Dispatch(AssignedRoles, this, new RolesEventArgs(ids, roleNames), nameof(AssignedRoles));
scope.Complete();
}
}
@@ -1047,7 +1047,7 @@ namespace Umbraco.Core.Services.Implement
scope.WriteLock(Constants.Locks.MemberTree);
var ids = _memberGroupRepository.GetMemberIds(usernames);
_memberGroupRepository.DissociateRoles(ids, roleNames);
scope.Events.Dispatch(RemovedRoles, this, new RolesEventArgs(ids, roleNames));
scope.Events.Dispatch(RemovedRoles, this, new RolesEventArgs(ids, roleNames), nameof(RemovedRoles));
scope.Complete();
}
}
@@ -1063,7 +1063,7 @@ namespace Umbraco.Core.Services.Implement
{
scope.WriteLock(Constants.Locks.MemberTree);
_memberGroupRepository.AssignRoles(memberIds, roleNames);
scope.Events.Dispatch(AssignedRoles, this, new RolesEventArgs(memberIds, roleNames));
scope.Events.Dispatch(AssignedRoles, this, new RolesEventArgs(memberIds, roleNames), nameof(AssignedRoles));
scope.Complete();
}
}
@@ -1079,7 +1079,7 @@ namespace Umbraco.Core.Services.Implement
{
scope.WriteLock(Constants.Locks.MemberTree);
_memberGroupRepository.DissociateRoles(memberIds, roleNames);
scope.Events.Dispatch(RemovedRoles, this, new RolesEventArgs(memberIds, roleNames));
scope.Events.Dispatch(RemovedRoles, this, new RolesEventArgs(memberIds, roleNames), nameof(RemovedRoles));
scope.Complete();
}
}