PublishedContent - implement a model factory

This commit is contained in:
Stephan
2013-09-13 21:15:40 +02:00
parent ac19ac7a6b
commit 85cb7fadfc
8 changed files with 288 additions and 2 deletions

View File

@@ -227,6 +227,36 @@ namespace Umbraco.Tests.PublishedContent
public object XPathValue { get; set; }
}
[PublishedContentModel("ContentType2")]
public class ContentType2 : PublishedContentModel
{
#region Plumbing
public ContentType2(IPublishedContent content)
: base(content)
{ }
#endregion
// fast, if you know that the appropriate IPropertyEditorValueConverter is wired
public int Prop1 { get { return (int)this["prop1"]; } }
// almost as fast, not sure I like it as much, though
//public int Prop1 { get { return this.GetPropertyValue<int>("prop1"); } }
}
[PublishedContentModel("ContentType2Sub")]
public class ContentType2Sub : ContentType2
{
#region Plumbing
public ContentType2Sub(IPublishedContent content)
: base(content)
{ }
#endregion
}
class PublishedContentStrong1 : PublishedContentExtended
{
public PublishedContentStrong1(IPublishedContent content)