From fc43ff3c98bad3f0c6df31dddefd192bdab9a77f Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 12 May 2021 14:23:59 +0300 Subject: Moved the Guid Id to it's own base models --- tools/add-feature-template.sh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'tools') 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; }" -- cgit v1.2.3