diff options
Diffstat (limited to 'tools/add-feature-template.sh')
| -rwxr-xr-x | tools/add-feature-template.sh | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/add-feature-template.sh b/tools/add-feature-template.sh index bf9d8ac..edce00d 100755 --- a/tools/add-feature-template.sh +++ b/tools/add-feature-template.sh @@ -26,9 +26,8 @@ using System; namespace $project_name.Data.Models { - public class $feature_name + public class $feature_name : BaseModel { - public Guid Id { get; set; } $( for feature in "${features[@]}"; do echo -e "\t\tpublic $feature { get; set; }" @@ -145,17 +144,20 @@ models=("View" "" "Edit") for model in "${models[@]}" do cat > $subdir/$model${feature_name}ServiceModel.cs<< EOF -using System; +using System;$( +if [ ! -z $model ]; then +echo -e "\nusing $project_name.Services.Models;" +fi +) namespace $project_name.Services.Models.$feature_name { - public class $model${feature_name}ServiceModel - {$( + public class $model${feature_name}ServiceModel$( if [ ! -z $model ]; then -echo -e "\n\t\tpublic Guid Id { get; set; }" +echo -e ' : BaseServiceModel' fi ) -$( + {$( for feature in "${features[@]}"; do echo -e "\t\tpublic $feature { get; set; }" done @@ -224,11 +226,19 @@ models=("View" "" "Edit") for model in "${models[@]}" do cat > $subdir/$model${feature_name}WebModel.cs<< EOF -using System; +using System;$( +if [ ! -z $model ]; then +echo -e "\nusing $project_name.Web.Models;" +fi +) namespace $project_name.Web.Models.$feature_name { - public class $model${feature_name}WebModel + public class $model${feature_name}WebModel$( +if [ ! -z $model ]; then +echo -e ' : BaseWebModel' +fi +) {$( if [ ! -z $model ]; then echo -e "\n\t\tpublic Guid Id { get; set; }" |
