Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Josip 195 posts 662 karma points c-trib
    Mar 04, 2021 @ 13:06
    Josip
    0

    How to get property alias

    Hi all, I am having trouble with retrieving propery alias.

    I need to do something like this here:

    var NameAlias = memberModel.Name.Alias;
    

    This is how my code looks like now:

            var currentMember = Members.GetCurrentMember();
    
            MemberProfileDetails customModel = new MemberProfileDetails();
    
            Member memberModel = new Member(currentMember);
    
            customModel.CompanyId = memberModel.Id;
    
            // Company Details
            customModel.CompanyName     = memberModel.Name;
    
  • AddWeb Solution Pvt. Ltd 109 posts 360 karma points
    Mar 05, 2021 @ 07:47
    AddWeb Solution Pvt. Ltd
    100

    Hello Josip,

    To get a property alias based on a generated model you can try like this :-

    var propertyType = ModelClassName.GetModelPropertyType(d => d.PropertyName);
    var alias = propertyType.PropertyTypeAlias;
    

    Also, refer this(https://our.umbraco.com/packages/developer-tools/ditto/ditto-feedback/79462-umbraco-property-type-alias-of-the-property-beeing-processed)

Please Sign in or register to post replies

Write your reply to:

Draft