Reverting changes in Migration.

Adding String.IsNullOrEmpty instead of == ""
Fixed migration code to use ContentDefinitionManager only
Fixed return numbers on migration
using DefaultJsonConverter service in AutorouteSettings.cs
This commit is contained in:
Skrypt
2015-06-11 23:53:41 -04:00
parent 23f3f29a47
commit 8beec81217
13 changed files with 49 additions and 62 deletions

View File

@@ -75,13 +75,23 @@ namespace Orchard.Autoroute.Drivers {
} }
} }
//we update the settings assuming that when
//pattern culture = null it means culture = default website culture
//for patterns that we migrated
foreach (RoutePattern pattern in settings.Patterns.Where(x => String.IsNullOrEmpty(x.Culture))) {
pattern.Culture = _cultureManager.GetSiteCulture(); ;
}
//we do the same for default patterns
foreach (DefaultPattern pattern in settings.DefaultPatterns.Where(x => String.IsNullOrEmpty(x.Culture))) {
pattern.Culture = _cultureManager.GetSiteCulture();
}
// if the content type has no pattern for autoroute, then use a default one // if the content type has no pattern for autoroute, then use a default one
if (!settings.Patterns.Any(x => x.Culture == itemCulture)) { if (!settings.Patterns.Any(x => x.Culture == itemCulture)) {
settings.AllowCustomPattern = true; settings.AllowCustomPattern = true;
settings.AutomaticAdjustmentOnEdit = false; settings.AutomaticAdjustmentOnEdit = false;
settings.Patterns = new List<RoutePattern> { new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = itemCulture } }; settings.Patterns = new List<RoutePattern> { new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = itemCulture } };
_notifier.Warning(T("No route patterns are currently defined for this Content Type. If you don't set one in the settings, a default one will be used."));
} }
// if the content type has no defaultPattern for autoroute, then use a default one // if the content type has no defaultPattern for autoroute, then use a default one

View File

@@ -3,21 +3,14 @@ using Orchard.Autoroute.Services;
using Orchard.Autoroute.Settings; using Orchard.Autoroute.Settings;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.ContentManagement.MetaData; using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.Core.Contents.Extensions; using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration; using Orchard.Data.Migration;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Orchard.Autoroute { namespace Orchard.Autoroute {
public class Migrations : DataMigrationImpl { public class Migrations : DataMigrationImpl {
private readonly IAutorouteService _autorouteService;
private readonly IContentManager _contentManager;
public Migrations(
IAutorouteService autorouteService,
IContentManager contentManager) {
_autorouteService = autorouteService;
_contentManager = contentManager;
}
public int Create() { public int Create() {
SchemaBuilder.CreateTable("AutoroutePartRecord", SchemaBuilder.CreateTable("AutoroutePartRecord",
@@ -25,6 +18,7 @@ namespace Orchard.Autoroute {
.ContentPartVersionRecord() .ContentPartVersionRecord()
.Column<string>("CustomPattern", c => c.WithLength(2048)) .Column<string>("CustomPattern", c => c.WithLength(2048))
.Column<bool>("UseCustomPattern", c => c.WithDefault(false)) .Column<bool>("UseCustomPattern", c => c.WithDefault(false))
.Column<bool>("UseCulturePattern", c => c.WithDefault(false))
.Column<string>("DisplayAlias", c => c.WithLength(2048))); .Column<string>("DisplayAlias", c => c.WithLength(2048)));
ContentDefinitionManager.AlterPartDefinition("AutoroutePart", part => part ContentDefinitionManager.AlterPartDefinition("AutoroutePart", part => part
@@ -35,7 +29,7 @@ namespace Orchard.Autoroute {
.CreateIndex("IDX_AutoroutePartRecord_DisplayAlias", "DisplayAlias") .CreateIndex("IDX_AutoroutePartRecord_DisplayAlias", "DisplayAlias")
); );
return 3; return 4;
} }
public int UpdateFrom1() { public int UpdateFrom1() {
@@ -59,13 +53,14 @@ namespace Orchard.Autoroute {
.AddColumn<bool>("UseCulturePattern", c => c.WithDefault(false)) .AddColumn<bool>("UseCulturePattern", c => c.WithDefault(false))
); );
// populate the AutorouteSettings.DefaultPatternDefinitions AutoroutePart settings foreach (ContentTypeDefinition contentTypeDefinition in ContentDefinitionManager.ListTypeDefinitions()) {
foreach (var autoroutePart in _contentManager.Query<AutoroutePart, AutoroutePartRecord>().List()) { foreach (ContentTypePartDefinition contentTypePartDefinition in contentTypeDefinition.Parts.Where(x => x.PartDefinition.Name == "AutoroutePart")) {
var settings = autoroutePart.Settings.GetModel<AutorouteSettings>(); var settings = contentTypePartDefinition.Settings.GetModel<AutorouteSettings>();
string patternIndex = autoroutePart.Settings["AutorouteSettings.DefaultPatternIndex"]; string patternIndex = contentTypePartDefinition.Settings["AutorouteSettings.DefaultPatternIndex"];
settings.DefaultPatterns = new List<DefaultPattern> { new DefaultPattern { PatternIndex = patternIndex, Culture = "" } }; settings.DefaultPatterns = new List<DefaultPattern> { new DefaultPattern { PatternIndex = patternIndex, Culture = "" } };
ContentDefinitionManager.AlterTypeDefinition(autoroutePart.TypeDefinition.Name, builder => builder.WithPart("AutoroutePart", settings.Build)); ContentDefinitionManager.AlterTypeDefinition(contentTypeDefinition.Name, builder => builder.WithPart("AutoroutePart", settings.Build));
}
} }
return 4; return 4;

View File

@@ -82,6 +82,8 @@ namespace Orchard.Autoroute.Providers.ContentDefinition {
_contentDefinitionManager.AlterTypeDefinition(context.ContentTypeName, builder => builder.WithPart("AutoroutePart", settings.Build)); _contentDefinitionManager.AlterTypeDefinition(context.ContentTypeName, builder => builder.WithPart("AutoroutePart", settings.Build));
//TODO Generate URL's for existing content items //TODO Generate URL's for existing content items
//We should provide a global setting to enable/disable this feature
} }
} }

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Web.Script.Serialization;
using Orchard.ContentManagement.MetaData.Builders; using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Services;
namespace Orchard.Autoroute.Settings { namespace Orchard.Autoroute.Settings {
@@ -39,7 +39,7 @@ namespace Orchard.Autoroute.Settings {
public List<RoutePattern> Patterns { public List<RoutePattern> Patterns {
get { get {
if (_patterns == null) { if (_patterns == null) {
_patterns = new JavaScriptSerializer().Deserialize<RoutePattern[]>(PatternDefinitions).ToList(); _patterns = new DefaultJsonConverter().Deserialize<RoutePattern[]>(PatternDefinitions).ToList();
} }
return _patterns; return _patterns;
@@ -47,7 +47,7 @@ namespace Orchard.Autoroute.Settings {
set { set {
_patterns = value; _patterns = value;
PatternDefinitions = new JavaScriptSerializer().Serialize(_patterns.ToArray()); PatternDefinitions = new DefaultJsonConverter().Serialize(_patterns.ToArray());
} }
} }
@@ -59,7 +59,7 @@ namespace Orchard.Autoroute.Settings {
public List<DefaultPattern> DefaultPatterns { public List<DefaultPattern> DefaultPatterns {
get { get {
if (_defaultPatterns == null) { if (_defaultPatterns == null) {
_defaultPatterns = new JavaScriptSerializer().Deserialize<DefaultPattern[]>(DefaultPatternDefinitions).ToList(); _defaultPatterns = new DefaultJsonConverter().Deserialize<DefaultPattern[]>(DefaultPatternDefinitions).ToList();
} }
//We split the values from the radio button returned values //We split the values from the radio button returned values
@@ -86,7 +86,7 @@ namespace Orchard.Autoroute.Settings {
} }
i++; i++;
} }
DefaultPatternDefinitions = new JavaScriptSerializer().Serialize(_defaultPatterns.ToArray()); DefaultPatternDefinitions = new DefaultJsonConverter().Serialize(_defaultPatterns.ToArray());
} }
} }

View File

@@ -62,9 +62,9 @@ namespace Orchard.Autoroute.Settings {
//We add a pattern for each culture if there is none //We add a pattern for each culture if there is none
if (!settings.Patterns.Where(x => x.Culture == culture).Any()) { if (!settings.Patterns.Where(x => x.Culture == culture).Any()) {
//We add the default pattern from migrations //We add the default pattern from migrations
if (settings.Patterns.Where(x => x.Culture == "").Any()) { if (settings.Patterns.Where(x => String.IsNullOrEmpty(x.Culture)).Any()) {
//we add the RoutePattern and we set the culture since there is none defined //we add the RoutePattern and we set the culture since there is none defined
RoutePattern migrationRoutePattern = settings.Patterns.Where(x => x.Culture == "").First(); RoutePattern migrationRoutePattern = settings.Patterns.Where(x => String.IsNullOrEmpty(x.Culture)).First();
newPatterns.Add(new RoutePattern { Culture = culture, Name = migrationRoutePattern.Name, Description = migrationRoutePattern.Description, Pattern = migrationRoutePattern.Pattern }); newPatterns.Add(new RoutePattern { Culture = culture, Name = migrationRoutePattern.Name, Description = migrationRoutePattern.Description, Pattern = migrationRoutePattern.Pattern });
} else { } else {
//we add the default pattern for custom content types or modules that don't define it in their migration //we add the default pattern for custom content types or modules that don't define it in their migration
@@ -107,7 +107,7 @@ namespace Orchard.Autoroute.Settings {
List<RoutePattern> newPatterns = new List<RoutePattern>(); List<RoutePattern> newPatterns = new List<RoutePattern>();
int current = 0; int current = 0;
foreach (string culture in settings.SiteCultures) { foreach (string culture in settings.SiteCultures) {
if (settings.Patterns.Any(x => x.Culture == culture)) { if (settings.Patterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
foreach (RoutePattern routePattern in settings.Patterns.Where(x => x.Culture == culture)) { foreach (RoutePattern routePattern in settings.Patterns.Where(x => x.Culture == culture)) {
newPatterns.Add(settings.Patterns[current]); newPatterns.Add(settings.Patterns[current]);
current++; current++;

View File

@@ -39,8 +39,7 @@ namespace Orchard.Blogs {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-blog\",\"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-blog\"}]"))
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]"))
.WithPart("MenuPart") .WithPart("MenuPart")
.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2")) .WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2"))
); );
@@ -58,8 +57,7 @@ namespace Orchard.Blogs {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Blog and Title\",\"Pattern\":\"{Content.Container.Path}/{Content.Slug}\",\"Description\":\"my-blog/my-post\",\"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Blog and Title\",\"Pattern\":\"{Content.Container.Path}/{Content.Slug}\",\"Description\":\"my-blog/my-post\"}]"))
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]"))
.WithPart("BodyPart") .WithPart("BodyPart")
.Draftable() .Draftable()
); );

View File

@@ -12,8 +12,8 @@ namespace Orchard.CustomForms {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\",\"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\"}]")
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]")) .WithSetting("AutorouteSettings.DefaultPatternIndex", "0"))
.WithPart("MenuPart") .WithPart("MenuPart")
.WithPart("CustomFormPart") .WithPart("CustomFormPart")
.DisplayedAs("Custom Form") .DisplayedAs("Custom Form")

View File

@@ -21,8 +21,7 @@ namespace Orchard.DynamicForms {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\"}]"))
.WithSetting("AutorouteSettings.DefaultPatternIndex", "0"))
.WithPart("LayoutPart", p => p .WithPart("LayoutPart", p => p
.WithSetting("LayoutTypePartSettings.DefaultLayoutData", .WithSetting("LayoutTypePartSettings.DefaultLayoutData",
"{" + "{" +
@@ -66,15 +65,5 @@ namespace Orchard.DynamicForms {
.DisplayedAs("Form Widget")); .DisplayedAs("Form Widget"));
return 1; return 1;
} }
public int UpdateFrom1() {
ContentDefinitionManager.AlterTypeDefinition("Form", type => type
.WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\",\"Culture\":\"\"}]")
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]"))
);
return 2;
}
} }
} }

View File

@@ -11,10 +11,9 @@ namespace Orchard.Lists {
.WithPart("ContainerPart") .WithPart("ContainerPart")
.WithPart("MenuPart") .WithPart("MenuPart")
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-list\",\"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-list\"}]")));
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]")));
return 4; return 4;
} }

View File

@@ -5,7 +5,7 @@ using Orchard.Data.Migration;
namespace Orchard.Pages { namespace Orchard.Pages {
public class Migrations : DataMigrationImpl { public class Migrations : DataMigrationImpl {
public int Create() { public int Create() {
ContentDefinitionManager.AlterTypeDefinition("Page", ContentDefinitionManager.AlterTypeDefinition("Page",
cfg => cfg cfg => cfg
.WithPart("CommonPart", p => p .WithPart("CommonPart", p => p
.WithSetting("DateEditorSettings.ShowDateEditor", "True")) .WithSetting("DateEditorSettings.ShowDateEditor", "True"))
@@ -14,8 +14,7 @@ namespace Orchard.Pages {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-page\",\"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-page\"}]"))
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]"))
.WithPart("LayoutPart") .WithPart("LayoutPart")
.Creatable() .Creatable()
.Listable() .Listable()

View File

@@ -126,7 +126,7 @@ namespace Orchard.Projections {
.Column<bool>("CreateLabel") .Column<bool>("CreateLabel")
.Column<string>("Label", c => c.WithLength(255)) .Column<string>("Label", c => c.WithLength(255))
.Column<bool>("LinkToContent") .Column<bool>("LinkToContent")
.Column<bool>("CustomizePropertyHtml") .Column<bool>("CustomizePropertyHtml")
.Column<string>("CustomPropertyTag", c => c.WithLength(64)) .Column<string>("CustomPropertyTag", c => c.WithLength(64))
.Column<string>("CustomPropertyCss", c => c.WithLength(64)) .Column<string>("CustomPropertyCss", c => c.WithLength(64))
@@ -190,8 +190,7 @@ namespace Orchard.Projections {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-projections\",\"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-projections\"}]"))
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]"))
.WithPart("MenuPart") .WithPart("MenuPart")
.WithPart("ProjectionPart") .WithPart("ProjectionPart")
.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "5")) .WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "5"))

View File

@@ -36,8 +36,7 @@ namespace Orchard.Taxonomies {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-taxonomy\",\"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-taxonomy\"}]"))
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]"))
); );
SchemaBuilder.CreateTable("TermsPartRecord", table => table SchemaBuilder.CreateTable("TermsPartRecord", table => table

View File

@@ -105,8 +105,7 @@ namespace Orchard.Taxonomies.Services {
.WithPart("AutoroutePart", builder => builder .WithPart("AutoroutePart", builder => builder
.WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AllowCustomPattern", "true")
.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false")
.WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Taxonomy and Title', Pattern: '{Content.Container.Path}/{Content.Slug}', Description: 'my-taxonomy/my-term/sub-term', \"Culture\":\"\"}]") .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Taxonomy and Title', Pattern: '{Content.Container.Path}/{Content.Slug}', Description: 'my-taxonomy/my-term/sub-term'}]"))
.WithSetting("AutorouteSettings.DefaultPatternDefinitions", "[{\"PatternIndex\":\"0\",\"Culture\":\"\"}]"))
.WithPart("CommonPart") .WithPart("CommonPart")
.DisplayedAs(taxonomy.Name + " Term") .DisplayedAs(taxonomy.Name + " Term")
); );
@@ -216,8 +215,7 @@ namespace Orchard.Taxonomies.Services {
termPart.As<ICommonPart>().Container = GetTaxonomy(termPart.TaxonomyId).ContentItem; termPart.As<ICommonPart>().Container = GetTaxonomy(termPart.TaxonomyId).ContentItem;
_contentManager.Create(termPart); _contentManager.Create(termPart);
} } else {
else {
_notifier.Warning(T("The term {0} already exists in this taxonomy", termPart.Name)); _notifier.Warning(T("The term {0} already exists in this taxonomy", termPart.Name));
} }
} }
@@ -282,8 +280,7 @@ namespace Orchard.Taxonomies.Services {
tpr => tpr.Terms.Any(tr => tpr => tpr.Terms.Any(tr =>
tr.TermRecord.Id == term.Id tr.TermRecord.Id == term.Id
|| tr.TermRecord.Path.StartsWith(rootPath))); || tr.TermRecord.Path.StartsWith(rootPath)));
} } else {
else {
query = query.Where( query = query.Where(
tpr => tpr.Terms.Any(tr => tpr => tpr.Terms.Any(tr =>
tr.Field == fieldName tr.Field == fieldName