/// <summary> /// Gets the custom constructors parameter string. /// </summary> /// <param name="spacesIndented">The number of spaces to indent.</param> /// <returns>The custom constructors parameter string.</returns> public string GetCustomConstructorParametersString(int spacesIndented) { //Extract required constructor parameters var requiredProperties = ConstructorProperties.Where(p => p.ConstructorArgumentType == ConstructorArgumentType.Required); var optionalProperties = ConstructorProperties.Where(p => p.ConstructorArgumentType == ConstructorArgumentType.Optional); List <string> argumentStrings = new List <string>(); foreach (PropertyData requiredProperty in requiredProperties) { argumentStrings.Add(string.Format("{0} {1}", requiredProperty.Type, requiredProperty.CamelName)); } foreach (PropertyData optionalProperty in optionalProperties) { argumentStrings.Add(string.Format("{0} {1} = default({0})", optionalProperty.Type, optionalProperty.CamelName)); } return(GenerateConstructorParameterString(argumentStrings, spacesIndented)); }
/// <summary> /// Gets the additional property initialization statements /// </summary> public IEnumerable <string> AdditionalPropertyInitializationStatements(IList <string> excluded = null) => ConstructorProperties.Where(p => !string.IsNullOrEmpty(p.AdditionalPropertyInitializationStatement) && (excluded == null || excluded.Contains(p.Name) == false)).Select(p => p.AdditionalPropertyInitializationStatement);