diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Controllers/LayoutController.cs b/src/Orchard.Web/Modules/Orchard.Projections/Controllers/LayoutController.cs index a82a37412..c5dd35f96 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Controllers/LayoutController.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Controllers/LayoutController.cs @@ -105,7 +105,7 @@ namespace Orchard.Projections.Controllers { model.Form = form; if (ModelState.IsValid) { - var layoutRecord = new LayoutRecord { Guid = Guid.NewGuid().ToString() ,Category = model.Category, Type = model.Type }; + var layoutRecord = new LayoutRecord { Guid = Guid.NewGuid() ,Category = model.Category, Type = model.Type }; var query = _queryService.GetQuery(model.QueryId); query.Layouts.Add(layoutRecord); diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Drivers/QueryPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Projections/Drivers/QueryPartDriver.cs index daa2b7c9c..bd544729d 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Drivers/QueryPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Drivers/QueryPartDriver.cs @@ -173,7 +173,7 @@ namespace Orchard.Projections.Drivers { } return new LayoutRecord { - Guid = guid, + Guid = !String.IsNullOrWhiteSpace(guid) ? Guid.Parse(guid) : Guid.NewGuid(), Category = category, Description = layout.Attribute("Description").Value, Display = int.Parse(layout.Attribute("Display").Value), diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs index f6eba20ee..863443c78 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs @@ -1,4 +1,5 @@ -using System.Data; +using System; +using System.Data; using Orchard.ContentManagement.MetaData; using Orchard.Core.Common.Models; using Orchard.Core.Contents.Extensions; @@ -102,7 +103,7 @@ namespace Orchard.Projections { SchemaBuilder.CreateTable("LayoutRecord", table => table .Column("Id", c => c.PrimaryKey().Identity()) - .Column("Guid", c => c.WithLength(64)) + .Column("Guid") .Column("Category", c => c.WithLength(64)) .Column("Type", c => c.WithLength(64)) .Column("Description", c => c.WithLength(255)) @@ -279,7 +280,7 @@ namespace Orchard.Projections { public int UpdateFrom3() { SchemaBuilder.AlterTable("LayoutRecord", table => table - .AddColumn("Guid", c => c.WithLength(64)) + .AddColumn("Guid") ); SchemaBuilder.AlterTable("LayoutRecord", table => table diff --git a/src/Orchard.Web/Modules/Orchard.Projections/Models/LayoutRecord.cs b/src/Orchard.Web/Modules/Orchard.Projections/Models/LayoutRecord.cs index 4415517b9..f3386fadb 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/Models/LayoutRecord.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/Models/LayoutRecord.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Orchard.Data.Conventions; @@ -9,7 +10,7 @@ namespace Orchard.Projections.Models { } public virtual int Id { get; set; } - public virtual string Guid { get; set; } + public virtual Guid Guid { get; set; } public virtual string Description { get; set; } public virtual string Category { get; set; } public virtual string Type { get; set; }