- ContentPartDefinitionBuilder

--HG--
branch : dev
This commit is contained in:
Suha Can
2010-06-11 11:51:17 -07:00
parent 699987217f
commit e7c7ae79e0

View File

@@ -1,18 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement.MetaData.Models;
namespace Orchard.ContentManagement.MetaData.Builders {
public class ContentPartDefinitionBuilder {
public ContentPartDefinitionBuilder(ContentPartDefinition partDefinition) {
throw new NotImplementedException();
private readonly string _name;
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() {
throw new NotImplementedException();
return new ContentPartDefinition(_name, _fields, _settings);
}
public ContentPartDefinitionBuilder WithSetting(string name, string value) {
throw new NotImplementedException();
_settings[name] = value;
return this;
}
}