예제 #1
0
        protected virtual string GenerateModelSourceCode(ModelsGeneratorInput modelsGeneratorInput)
        {
            var    modelName   = modelsGeneratorInput.ClassName;
            string newClassStr = "public class " +
                                 modelName +
                                 GenerateBaseClass(modelsGeneratorInput) +
                                 "\n{\n";

            foreach (var param in modelsGeneratorInput.Params)
            {
                var paramName = param.ParamName;
                paramName = paramName[0].ToString().ToUpper() + paramName.Substring(1);
                var attrs        = GenerateAttributes(param.ParamInfo);
                var newClassProp = attrs
                                   + "public "
                                   + GetTypeName(param.ParamInfo.ParameterType)
                                   + " "
                                   + paramName
                                   + " { get; set; }";
                newClassStr += "\n" + TextExtensions.AddTabs(newClassProp, 1) + "\n";
            }
            newClassStr += "\n}";
            return(newClassStr);
        }