Defining Parameters

Define parameters in Razor functions

You can use parameters with your Razor functions by declaring them as public 'get' properties.

To specify the label, help text and the default value, use the FunctionParameter attribute.

@functions {
  // these two  properties will be input parameters 
  // with labels, help texts and the default values
  [FunctionParameter("News filter" , "Help" , null)]
  public  Expression<Func<Omnicorp.Content.News, bool>> NewsFilter { get; set; }

  [FunctionParameter("Count" , "Help", 10)]
  public int Count { get; set; }
  // this will be an input parameter
  // without a label, help text and the default value
  public int PageSize { get; set; }

  // this will not be an input parameter
  // because it is not declared public
  protected int Page { get; set; }