Working on

This commit is contained in:
Shannon
2014-03-11 14:23:51 +11:00
parent ec6cb4520c
commit d737afa327
18 changed files with 628 additions and 94 deletions

View File

@@ -15,7 +15,7 @@ namespace Umbraco.Core.Models
public class Member : ContentBase, IMember
{
private readonly IMemberType _contentType;
private string _contentTypeAlias;
private readonly string _contentTypeAlias;
private string _username;
private string _email;
private string _password;
@@ -30,6 +30,7 @@ namespace Umbraco.Core.Models
public Member(string name, IMemberType contentType)
: base(name, -1, contentType, new PropertyCollection())
{
_contentTypeAlias = contentType.Alias;
_contentType = contentType;
IsApproved = true;
}
@@ -40,6 +41,7 @@ namespace Umbraco.Core.Models
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentTypeAlias = contentType.Alias;
_contentType = contentType;
_email = email;
_username = username;
@@ -52,6 +54,7 @@ namespace Umbraco.Core.Models
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentTypeAlias = contentType.Alias;
_contentType = contentType;
_email = email;
_username = username;
@@ -424,14 +427,6 @@ namespace Umbraco.Core.Models
public virtual string ContentTypeAlias
{
get { return _contentTypeAlias; }
internal set
{
SetPropertyValueAndDetectChanges(o =>
{
_contentTypeAlias = value;
return _contentTypeAlias;
}, _contentTypeAlias, DefaultContentTypeAliasSelector);
}
}
/// <summary>

View File

@@ -141,9 +141,21 @@ namespace Umbraco.Core.Models.PublishedContent
if (GetPublishedContentTypeCallback != null)
return GetPublishedContentTypeCallback(alias);
var contentType = itemType == PublishedItemType.Content
? (IContentTypeComposition)ApplicationContext.Current.Services.ContentTypeService.GetContentType(alias)
: (IContentTypeComposition)ApplicationContext.Current.Services.ContentTypeService.GetMediaType(alias);
IContentTypeComposition contentType;
switch (itemType)
{
case PublishedItemType.Content:
contentType = ApplicationContext.Current.Services.ContentTypeService.GetContentType(alias);
break;
case PublishedItemType.Media:
contentType = ApplicationContext.Current.Services.ContentTypeService.GetMediaType(alias);
break;
case PublishedItemType.Member:
contentType = ApplicationContext.Current.Services.MemberTypeService.Get(alias);
break;
default:
throw new ArgumentOutOfRangeException("itemType");
}
if (contentType == null)
throw new Exception(string.Format("ContentTypeService failed to find a {0} type with alias \"{1}\".",

View File

@@ -13,6 +13,11 @@ namespace Umbraco.Core.Models
/// <summary>
/// A media.
/// </summary>
Media
Media,
/// <summary>
/// A member.
/// </summary>
Member
}
}