System Library Common Episerver
Search Results for

    DocFx,SystemLibrary.Common.Episerver.Properties.MessageConfig,SystemLibrary.Common.Episerver.Properties.MessageEditorDescriptor,SystemLibrary.Common.Episerver.Properties.MessageProperty,SystemLibrary.Common.Episerver.Properties.MessageController,SystemLibrary.Common.Episerver.Attributes.BoxSelectionController,SystemLibrary.Common.Episerver.Attributes.BoxSelectionFactory,SystemLibrary.Common.Episerver.Attributes.JsonEditController,SystemLibrary.Common.Episerver.Attributes.JsonEditFactory,SystemLibrary.Common.Episerver.Descriptors.HideCategoryListDescriptor,SystemLibrary.Common.Episerver.Properties.ParentLinkReferenceController,SystemLibrary.Common.Episerver.Properties.ParentLinkReferenceEditorDescriptor,SystemLibrary.Common.Episerver.Properties.ParentLinkReferenceProperty,SystemLibrary.Common.Episerver.Attributes.MultiDropdownSelectionController,SystemLibrary.Common.Episerver.Attributes.MultiDropdownSelectionFactory,SystemLibrary.Common.Episerver.Initialize.RemoveSuggestedContentTypes,SystemLibrary.Common.Episerver.Extensions.CommonEpiserverApplicationServicesOptions,SystemLibrary.Common.Episerver.Extensions.CommonEpiserverApplicationBuilderOptions,SystemLibrary.Common.Episerver.EditController,SystemLibrary.Common.Episerver.Abstract.BaseController,SystemLibrary.Common.Episerver.Abstract.BaseMultiSelectionFactory,SystemLibrary.Common.Episerver.ConnectionStringsConfig,SystemLibrary.Common.Episerver.PropertiesConfig,SystemLibrary.Common.Episerver.EditConfig,SystemLibrary.Common.Episerver.Properties.MessageConfig,SystemLibrary.Common.Episerver.FontAwesome,SystemLibrary.Common.Episerver.AppSettings.Configuration,SystemLibrary.Common.Episerver.Attributes.ParentLinkReferenceFactory,SystemLibrary.Common.Episerver.Abstract.InternalBaseController,WebApplicationInitializer
    Show / Hide Table of Contents
    NamespaceSystemLibrary.Common.Episerver.Extensions SystemLibrary.Common.Episerver.dll

    String extensions

    StringExtensions

    public static class StringExtensions

    Inheritance
    System.Object
    StringExtensions
    Examples
    Arguments
    X

    Methods

    Convert the 'text', which is a string (json string) that comes from a 'public virtual' property marked with JsonEdit attribute

    Read that json data as a List of T, or a simple T

    View Source

    public static T JsonEditAsObject<T>(this string text) where T : class

    X

    Convert the stored value from a JsonEdit attribute, which is stored as a string, to a List of T

    class Car {
      public string Name { get; set; }
    }
    [JsonEdit(Type = typeof(Car))]
    public virtual string Cars { get; set; }
    
    public class Controller 
    {
        ActionResult Index(Block currentBlock) //or page 
        {
            var cars = currentBlock.Cars.JsonEditAsObject<List<Car>>();
            // cars is now a list of cars or empty
        }
    }
    X
    Generic types
    Name Description
    T
    Methods arguments
    Type Name Description
    System.String text
    X
    Type Description
    T

    Returns a simple object T or a List of T, based on the json string that comes from a 'public virtual' property marked with JsonEdit attribute

    Returns a friendly url version of the passed in url, usually a episerver content link or similar

    View Source

    public static string ToFriendlyUrl(this string url, bool? convertToAbsolute = null)

    X
    Methods arguments
    Type Name Description
    System.String url
    System.Nullable<System.Boolean> convertToAbsolute

    Pass null, which is default, to not convert, if input is absolute it returns absolute, else relative. Set to 'false' to force a relative return value, set to 'true' to force a absolute path based on CMS PrimaryDomain value

    X
    Type Description
    System.String

    Returns friendly url, never null, minimum ""

    }

    • View Source
    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Episerver