private void SynchronizeMemberType(Type typeMemberType, Type basetypeMemberType) { MemberTypeAttribute memberTypeAttr = this.GetMemberTypeAttribute(typeMemberType); string memberTypeName = string.IsNullOrEmpty(memberTypeAttr.Name) ? typeMemberType.Name : memberTypeAttr.Name; string memberTypeAlias = MemberTypeManager.GetMemberTypeAlias(typeMemberType); try { this.AddToSynchronized(typeMemberType.Name, memberTypeAlias, typeMemberType); } catch (ArgumentException exc) { throw new Exception(string.Format("Member type with alias '{0}' already exists! Please use unique class names as class name is used as alias. Member type causing the problem: '{1}' (assembly: '{2}'). Error message: {3}", memberTypeAlias, typeMemberType.FullName, typeMemberType.Assembly.FullName, exc.Message)); } _memberTypes.Add(memberTypeAlias, typeMemberType); MemberType memberType = MemberType.GetByAlias(memberTypeAlias); if (memberType == null) { memberType = MemberType.MakeNew(new umbraco.BusinessLogic.User(0), memberTypeAttr.Name); } memberType.Alias = memberTypeAlias; memberType.IconUrl = memberTypeAttr.IconUrl; memberType.Thumbnail = memberTypeAttr.Thumbnail; memberType.Description = memberTypeAttr.Description; SynchronizeMemberTypeProperties(typeMemberType, memberType); memberType.Save(); }
public static MemberType GetMemberType(Type typeMemberType) { return(MemberType.GetByAlias(MemberTypeManager.GetMemberTypeAlias(typeMemberType))); }