mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Shifting MessageSettingsPart
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Data;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Messaging.Models;
|
||||
|
||||
namespace Orchard.Messaging.Handlers {
|
||||
[UsedImplicitly]
|
||||
public class MessageSettingsPartHandler : ContentHandler {
|
||||
public MessageSettingsPartHandler(IRepository<MessageSettingsPartRecord> repository) {
|
||||
public MessageSettingsPartHandler() {
|
||||
Filters.Add(new ActivatingFilter<MessageSettingsPart>("Site"));
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,10 +4,6 @@ namespace Orchard.Messaging {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("MessageSettingsPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("DefaultChannelService", c => c.WithLength(64))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@@ -2,12 +2,14 @@
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Messaging.Models {
|
||||
public class MessageSettingsPart : ContentPart<MessageSettingsPartRecord> {
|
||||
public class MessageSettingsPart : ContentPart {
|
||||
|
||||
[StringLength(MessageSettingsPartRecord.DefaultChannelServiceLength)]
|
||||
public const ushort DefaultChannelServiceLength = 64;
|
||||
|
||||
[StringLength(DefaultChannelServiceLength)]
|
||||
public string DefaultChannelService {
|
||||
get { return Record.DefaultChannelService; }
|
||||
set { Record.DefaultChannelService = value; }
|
||||
get { return this.Retrieve(x => x.DefaultChannelService); }
|
||||
set { this.Store(x => x.DefaultChannelService, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,15 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Messaging.Models {
|
||||
public class MessageSettingsPartRecord : ContentPartRecord {
|
||||
public const ushort DefaultChannelServiceLength = 64;
|
||||
|
||||
/// <summary>
|
||||
/// Default service used for messages
|
||||
/// </summary>
|
||||
[StringLength(DefaultChannelServiceLength)]
|
||||
public virtual string DefaultChannelService { get; set; }
|
||||
|
||||
}
|
||||
}
|
@@ -19,12 +19,12 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<UseIISExpress>false</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -68,7 +68,6 @@
|
||||
<Compile Include="Handlers\MessageSettingsPartHandler.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Models\MessageSettingsPart.cs" />
|
||||
<Compile Include="Models\MessageSettingsPartRecord.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\MessageSettingsPartViewModel.cs" />
|
||||
</ItemGroup>
|
||||
|
@@ -128,7 +128,14 @@ namespace Upgrade.Controllers {
|
||||
|
||||
_upgradeService.ExecuteReader("DROP TABLE " + _upgradeService.GetPrefixedTableName("Orchard_Comment_CommentSettingsPartRecord"), null);
|
||||
|
||||
// MessageSettingsPartRecord
|
||||
_upgradeService.ExecuteReader("SELECT * FROM " + _upgradeService.GetPrefixedTableName("Orchard_Messaging_MessageSettingsPartRecord"),
|
||||
(reader, connection) => {
|
||||
site.As<InfosetPart>().Store("MessageSettingsPart", "DefaultChannelService", (bool)reader["DefaultChannelService"]);
|
||||
});
|
||||
|
||||
_upgradeService.ExecuteReader("DROP TABLE " + _upgradeService.GetPrefixedTableName("Orchard_Messaging_MessageSettingsPartRecord"), null);
|
||||
|
||||
_orchardServices.Notifier.Information(T("Site Settings migrated successfully"));
|
||||
|
||||
return View();
|
||||
|
Reference in New Issue
Block a user