EasyAbp / AbpHelper.CLI

Providing code generation and more features to help you develop applications and modules with the ABP framework.
MIT License
285 stars 95 forks source link

Comma will not be added to constructor when entity has composite keys #131

Closed RayMMond closed 3 years ago

RayMMond commented 3 years ago

https://github.com/EasyAbp/AbpHelper.CLI/blob/8b8405da1462f1c906e8a085cac01fcd1830b1b6/src/AbpHelper/Templates/Crud/Entity_PublicConstructor#L6-L10

Because EntityInfo.PrimaryKey is false, comma will not be added to constructor.

Suggestion:


        public {{ EntityInfo.Name }}(
            {{~ if EntityInfo.PrimaryKey ~}}
            {{ EntityInfo.PrimaryKey }} id,
            {{- end -}}
            {{- for prop in EntityInfo.Properties -}}
            {{""}}
            {{ prop.Type }} {{ prop.Name | abp.camel_case }}
            {{- if for.last; "\r\n"; else; ","; end -}}
            {{- end ~}}
        ){{ if EntityInfo.PrimaryKey }} : base(id){{~ end }}
        {
            {{~ for prop in EntityInfo.Properties ~}}
            {{ prop.Name }} = {{ prop.Name | abp.camel_case }};
            {{~ end ~}}
        }
wakuflair commented 3 years ago

Thanks.