mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
- ContentPartDefinitionBuilder
--HG-- branch : dev
This commit is contained in:
@@ -1,18 +1,36 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
|
|
||||||
namespace Orchard.ContentManagement.MetaData.Builders {
|
namespace Orchard.ContentManagement.MetaData.Builders {
|
||||||
public class ContentPartDefinitionBuilder {
|
public class ContentPartDefinitionBuilder {
|
||||||
public ContentPartDefinitionBuilder(ContentPartDefinition partDefinition) {
|
private readonly string _name;
|
||||||
throw new NotImplementedException();
|
private readonly IList<ContentPartDefinition.Field> _fields;
|
||||||
|
private readonly IDictionary<string, string> _settings;
|
||||||
|
|
||||||
|
public ContentPartDefinitionBuilder()
|
||||||
|
: this(new ContentPartDefinition(null)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContentPartDefinitionBuilder(ContentPartDefinition existing) {
|
||||||
|
if (existing == null) {
|
||||||
|
_fields = new List<ContentPartDefinition.Field>();
|
||||||
|
_settings = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_name = existing.Name;
|
||||||
|
_fields = existing.Fields.ToList();
|
||||||
|
_settings = existing.Settings.ToDictionary(kv => kv.Key, kv => kv.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentPartDefinition Build() {
|
public ContentPartDefinition Build() {
|
||||||
throw new NotImplementedException();
|
return new ContentPartDefinition(_name, _fields, _settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentPartDefinitionBuilder WithSetting(string name, string value) {
|
public ContentPartDefinitionBuilder WithSetting(string name, string value) {
|
||||||
throw new NotImplementedException();
|
_settings[name] = value;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user