/// <summary> /// Instances the entity from its definition stored in custom attribute /// </summary> /// <param name="attribute"></param> /// <exception cref="System.ArgumentException">Thrown if one of the params is null</exception> internal static Option FromAttribute(OptionDefinitionAttribute attribute) { var opt = MapFromAttribute(attribute); // check type LOVOptionDefinitionAttribute lovAttr = attribute as LOVOptionDefinitionAttribute; if (lovAttr != null) { return(FromLOVAttribute((LOVOptionDefinitionAttribute)attribute)); } return(opt); }
/// <summary> /// Instances the entity from its definition stored in custom attribute /// </summary> /// <param name="attribute"></param> /// <exception cref="System.ArgumentException">Thrown if one of the params is null</exception> static Option MapFromAttribute(OptionDefinitionAttribute attribute) { if (attribute == null) { throw new ArgumentNullException(nameof(attribute)); } var opt = new Option(attribute.Code, attribute.LongCode, attribute.Description); opt.Mandatory = attribute.Mandatory; opt.DefaultValue = attribute.DefaultValue; return(opt); }