diff --git a/.gitignore b/.gitignore index 7c65fa9..a5a4ead 100644 --- a/.gitignore +++ b/.gitignore @@ -289,4 +289,6 @@ __pycache__/ *.xsd.cs **/wwwroot/lib/** -nuget.exe \ No newline at end of file +nuget.exe + +cloudscribe.templates.test/ diff --git a/Content/WebApp/.template.config/template.json b/Content/WebApp/.template.config/template.json index 339d683..4e9f1ac 100644 --- a/Content/WebApp/.template.config/template.json +++ b/Content/WebApp/.template.config/template.json @@ -275,7 +275,11 @@ { "choice": "MySql", "description": "MySql storage using Entity Framework Core" - } + }, + { + "choice": "AllStorage", + "description": "All database storage types (for developing new cloudscribe modules)" + } ] }, @@ -308,6 +312,10 @@ "type": "computed", "value": "(DataStorage == \"NoDb\")" }, + "AllStorage": { + "type": "computed", + "value": "(DataStorage == \"AllStorage\")" + }, "UtmCampaign": { "type": "generated", "generator": "casing", diff --git a/Content/WebApp/Config/CloudscribeFeatures.cs b/Content/WebApp/Config/CloudscribeFeatures.cs index 4d06942..b64e1ee 100644 --- a/Content/WebApp/Config/CloudscribeFeatures.cs +++ b/Content/WebApp/Config/CloudscribeFeatures.cs @@ -7,16 +7,16 @@ #if (QueryTool && !NoDb) using cloudscribe.QueryTool.Services; -#if (MSSQL) +#if (MSSQL || AllStorage) using cloudscribe.QueryTool.EFCore.MSSQL; #endif -#if (MySql) +#if (MySql || AllStorage) using cloudscribe.QueryTool.EFCore.MySql; #endif -#if (pgsql) +#if (pgsql || AllStorage) using cloudscribe.QueryTool.EFCore.PostgreSql; #endif -#if (SQLite) +#if (SQLite || AllStorage) using cloudscribe.QueryTool.EFCore.SQLite; #endif #endif @@ -35,6 +35,7 @@ public static IServiceCollection SetupDataStorage( IWebHostEnvironment env ) { +#if (!AllStorage) #if (!NoDb && !SQLite) var connectionString = config.GetConnectionString("EntityFrameworkConnection"); #endif @@ -281,6 +282,233 @@ IWebHostEnvironment env #endif #endif +#endif +#if (AllStorage) + var storage = config["DevOptions:DbPlatform"].ToLowerInvariant(); + var efProvider = config["DevOptions:EFProvider"].ToLowerInvariant(); + string connectionString; + + switch (storage) + { + case "efcore": + switch (efProvider) + { + case "mysql": + connectionString = config.GetConnectionString("MySqlEntityFrameworkConnection"); + services.AddCloudscribeCoreEFStorageMySql(connectionString); +#if (KvpCustomRegistration || Newsletter) + services.AddCloudscribeKvpEFStorageMySql(connectionString); +#endif +#if (Logging) + services.AddCloudscribeLoggingEFStorageMySQL(connectionString); +#endif +#if (SimpleContentConfig != "z") + services.AddCloudscribeSimpleContentEFStorageMySQL(connectionString); +#endif +#if (IncludeStripeIntegration) + services.AddStripeIntegrationStorageMySql(connectionString); +#endif +#if (FormBuilder) + services.AddFormsStorageMySql(connectionString); +#endif +#if (DynamicPolicy) + services.AddDynamicPolicyEFStorageMySql(connectionString); +#endif +#if (Paywall) + services.AddMembershipSubscriptionStorageMySql(connectionString); +#endif +#if (IncludeEmailQueue) + services.AddEmailTemplateStorageMySql(connectionString); + services.AddEmailQueueStorageMySql(connectionString); +#endif +#if (Newsletter) + services.AddEmailListStorageMySql(connectionString); +#endif +#if (CommentSystem) + services.AddCommentStorageMySql(connectionString); +#endif +#if (Forum) + services.AddForumStorageMySql(connectionString); +#endif +#if (QueryTool) + services.AddQueryToolEFStorageMySql(connectionString); +#endif + break; + + case "pgsql": + connectionString = config.GetConnectionString("PostgreSqlEntityFrameworkConnection"); + services.AddCloudscribeCorePostgreSqlStorage(connectionString); +#if (KvpCustomRegistration || Newsletter) + services.AddCloudscribeKvpPostgreSqlStorage(connectionString); +#endif +#if (Logging) + services.AddCloudscribeLoggingPostgreSqlStorage(connectionString); +#endif +#if (SimpleContentConfig != "z") + services.AddCloudscribeSimpleContentPostgreSqlStorage(connectionString); +#endif +#if (IncludeStripeIntegration) + services.AddStripeIntegrationPostgreSqlStorage(connectionString); +#endif +#if (FormBuilder) + services.AddFormsStoragePostgreSql(connectionString); +#endif +#if (DynamicPolicy) + services.AddDynamicPolicyPostgreSqlStorage(connectionString); +#endif +#if (Paywall) + services.AddMembershipSubscriptionPostgreSqlStorage(connectionString); +#endif +#if (IncludeEmailQueue) + services.AddEmailTemplatePostgreSqlStorage(connectionString); + services.AddEmailQueuePostgreSqlStorage(connectionString); +#endif +#if (Newsletter) + services.AddEmailListPostgreSqlStorage(connectionString); +#endif +#if (CommentSystem) + services.AddCommentStoragePostgreSql(connectionString); +#endif +#if (Forum) + services.AddForumStoragePostgreSql(connectionString); +#endif +#if (QueryTool) + services.AddQueryToolEFStoragePostgreSql(connectionString); +#endif + break; + + case "sqlite": + var dbName = config.GetConnectionString("SQLiteDbName"); + var dbPath = Path.Combine(env.ContentRootPath, dbName); + connectionString = $"Data Source={dbPath}"; + services.AddCloudscribeCoreEFStorageSQLite(connectionString); +#if (KvpCustomRegistration || Newsletter) + services.AddCloudscribeKvpEFStorageSQLite(connectionString); +#endif +#if (Logging) + services.AddCloudscribeLoggingEFStorageSQLite(connectionString); +#endif +#if (SimpleContentConfig != "z") + services.AddCloudscribeSimpleContentEFStorageSQLite(connectionString); +#endif +#if (IncludeStripeIntegration) + services.AddStripeIntegrationStorageSQLite(connectionString); +#endif +#if (FormBuilder) + services.AddFormsStorageSQLite(connectionString); +#endif +#if (DynamicPolicy) + services.AddDynamicPolicyEFStorageSQLite(connectionString); +#endif +#if (Paywall) + services.AddMembershipSubscriptionStorageSQLite(connectionString); +#endif +#if (IncludeEmailQueue) + services.AddEmailTemplateStorageSQLite(connectionString); + services.AddEmailQueueStorageSQLite(connectionString); +#endif +#if (Newsletter) + services.AddEmailListStorageSQLite(connectionString); +#endif +#if (CommentSystem) + services.AddCommentStorageSQLite(connectionString); +#endif +#if (Forum) + services.AddForumStorageSQLite(connectionString); +#endif +#if (QueryTool) + services.AddQueryToolEFStorageSQLite(connectionString); +#endif + break; + + case "mssql": + default: + connectionString = config.GetConnectionString("EntityFrameworkConnection"); + services.AddCloudscribeCoreEFStorageMSSQL(connectionString); +#if (KvpCustomRegistration || Newsletter) + services.AddCloudscribeKvpEFStorageMSSQL(connectionString); +#endif +#if (Logging) + services.AddCloudscribeLoggingEFStorageMSSQL(connectionString); +#endif +#if (SimpleContentConfig != "z") + services.AddCloudscribeSimpleContentEFStorageMSSQL(connectionString); +#endif +#if (IncludeStripeIntegration) + services.AddStripeIntegrationStorageMSSQL(connectionString); +#endif +#if (FormBuilder) + services.AddFormsStorageMSSQL(connectionString); +#endif +#if (DynamicPolicy) + services.AddDynamicPolicyEFStorageMSSQL(connectionString); +#endif +#if (Paywall) + services.AddMembershipSubscriptionStorageMSSQL(connectionString); +#endif +#if (IncludeEmailQueue) + services.AddEmailTemplateStorageMSSQL(connectionString); + services.AddEmailQueueStorageMSSQL(connectionString); +#endif +#if (Newsletter) + services.AddEmailListStorageMSSQL(connectionString); +#endif +#if (CommentSystem) + services.AddCommentStorageMSSQL(connectionString); +#endif +#if (Forum) + services.AddForumStorageMSSQL(connectionString); +#endif +#if (QueryTool) + services.AddQueryToolEFStorageMSSQL(connectionString); +#endif + break; + } + break; + + case "nodb": + default: + services.AddCloudscribeCoreNoDbStorage(); +#if (KvpCustomRegistration || Newsletter) + services.AddCloudscribeKvpNoDbStorage(); +#endif +#if (Logging) + services.AddCloudscribeLoggingNoDbStorage(config); +#endif +#if (SimpleContentConfig != "z") + services.AddNoDbStorageForSimpleContent(); +#endif +#if (IncludeStripeIntegration) + services.AddStripeIntegrationStorageNoDb(); +#endif +#if (FormBuilder) + services.AddFormsStorageNoDb(); +#endif +#if (DynamicPolicy) + services.AddNoDbStorageForDynamicPolicies(config); +#endif +#if (Paywall) + services.AddMembershipSubscriptionStorageNoDb(); +#endif +#if (IncludeEmailQueue) + services.AddEmailTemplateStorageNoDb(); + services.AddEmailQueueStorageNoDb(); +#endif +#if (Newsletter) + services.AddEmailListStorageNoDb(); +#endif +#if (CommentSystem) + services.AddTalkAboutStorageNoDb(); +#endif +#if (Forum) + services.AddTalkAboutForumStorageNoDb(); +#endif +#if (QueryTool) + //The QueryTool can only work with Entity Framework databases and not with NoDb +#endif + break; + } +#endif return services; } @@ -299,16 +527,17 @@ IConfiguration config services.Configure(config.GetSection("ProfilePropertySetContainer")); #if (Newsletter) services.AddEmailListKvpIntegration(config); + #endif services.AddCloudscribeKvpUserProperties(); -#endif - +#endif services.AddScoped(); #if (SimpleContentConfig != "z") services.AddScoped(); #endif services.AddCloudscribeCoreMvc(config); + #if (SimpleContentConfig != "z") services.AddCloudscribeCoreIntegrationForSimpleContent(config); services.AddSimpleContentMvc(config); @@ -316,73 +545,84 @@ IConfiguration config services.AddMetaWeblogForSimpleContent(config.GetSection("MetaWeblogApiOptions")); services.AddSimpleContentRssSyndiction(); + #endif #if (ContactForm) services.AddCloudscribeSimpleContactFormCoreIntegration(config); services.AddCloudscribeSimpleContactForm(config); -#endif +#endif #if (FormBuilder) services.AddFormsCloudscribeCoreIntegration(config); services.AddFormsServices(config); + #if (SimpleContentConfig != "z") services.AddFormSurveyContentTemplatesForSimpleContent(config); + #endif // these are examples to show you how to implement custom form submission handlers. // see /Services/SampleFormSubmissionHandlers.cs services.AddScoped(); services.AddScoped(); -#endif +#endif #if (IncludeStripeIntegration) services.AddMembershipStripeIntegration(config); services.AddCloudscribeCoreStripeIntegration(); services.AddStripeIntegrationMvc(config); #endif - #if (Paywall) services.AddMembershipSubscriptionMvcComponents(config); services.AddMembershipBackgroundTasks(config); -#endif +#endif #if (IncludeEmailQueue) services.AddEmailQueueBackgroundTask(config); services.AddEmailQueueWithCloudscribeIntegration(config); services.AddEmailRazorTemplating(config); -#endif +#endif #if (Newsletter) services.AddEmailListWithCloudscribeIntegration(config); -#endif +#endif #if (DynamicPolicy) services.AddCloudscribeDynamicPolicyIntegration(config); services.AddDynamicAuthorizationMvc(config); -#endif -#if (CommentSystem || Forum) - services.AddTalkAboutCloudscribeIntegration(config); #endif +#if (CommentSystem || Forum) + services.AddTalkAboutCloudscribeIntegration(config); +#endif #if (Forum) services.AddTalkAboutForumServices(config) .AddTalkAboutForumNotificationServices(config); -#endif +#endif #if (CommentSystem) services.AddTalkAboutCommentsCloudscribeIntegration(config); services.AddTalkAboutServices(config) .AddTalkAboutNotificationServices(config); -#endif - +#endif +#if(!AllStorage) #if (QueryTool && !NoDb) //The QueryTool can only work with Entity Framework databases and not with NoDb services.AddScoped(); + #endif +#endif +#if(AllStorage) + var storage = config["DevOptions:DbPlatform"].ToLowerInvariant(); + if (storage == "efcore") + { + services.AddScoped(); + } +#endif return services; } diff --git a/Content/WebApp/WebApp.csproj b/Content/WebApp/WebApp.csproj index f26afd8..b98c6bb 100644 --- a/Content/WebApp/WebApp.csproj +++ b/Content/WebApp/WebApp.csproj @@ -3,10 +3,10 @@ net6.0 WebApp-4BC5DF1F-B155-4A69-9719-0AB349B1ACB2 - + true Latest - + @@ -31,12 +31,12 @@ - + - + @@ -49,23 +49,23 @@ - + - - + + - - + + - - + + - - + + - + - + @@ -76,173 +76,171 @@ - + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - - + + - + - + - - + + - - + + - - + + - - - + + - + - - + + - - + + - - + + - - + + - + @@ -250,19 +248,19 @@ - + - + - + - + - + @@ -271,93 +269,90 @@ - + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - - - + diff --git a/Content/WebApp/appsettings.Development.json b/Content/WebApp/appsettings.Development.json index d278c6b..d9a4d80 100644 --- a/Content/WebApp/appsettings.Development.json +++ b/Content/WebApp/appsettings.Development.json @@ -1,4 +1,5 @@ { + //#if (!AllStorage) //#if (!NoDb) "ConnectionStrings": { //#if (SQLite) @@ -11,26 +12,49 @@ "EntityFrameworkConnection": "Server=localhost;Database=yourdbname;Uid=yourdbuser;Pwd=yourdbpassword;Charset=utf8;", //#endif //#if (pgsql) - "EntityFrameworkConnection": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;", + "EntityFrameworkConnection": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;Pooling=true;Minimum Pool Size=0;Maximim Pool Size=20;", //#endif //#if (QueryTool) + //QueryTool should use a different connection string than the main app for security reasons (possibly readonly and no DDL commands) //#if (SQLite) - "QueryToolConnectionString": "Data Source=appdata.db;Pooling=false;Mode=ReadWrite", + "QueryToolConnectionString": "Data Source=appdata.db;Pooling=false;Mode=ReadWrite" //#endif //#if (MSSQL) - "QueryToolConnectionString": "Server=(localdb)\\mssqllocaldb;Database=WebApp-0353CAB0-205A-4FCD-9626-1282ECF47059;Trusted_Connection=True;MultipleActiveResultSets=true", + "QueryToolConnectionString": "Server=(localdb)\\mssqllocaldb;Database=WebApp-0353CAB0-205A-4FCD-9626-1282ECF47059;Trusted_Connection=True;MultipleActiveResultSets=true" //#endif //#if (MySql) - "QueryToolConnectionString": "Server=localhost;Database=yourdbname;Uid=yourdbuser;Pwd=yourdbpassword;Charset=utf8;", + "QueryToolConnectionString": "Server=localhost;Database=yourdbname;Uid=yourdbuser;Pwd=yourdbpassword;Charset=utf8;" //#endif //#if (pgsql) - "QueryToolConnectionString": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;" + "QueryToolConnectionString": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;Pooling=true;Minimum Pool Size=0;Maximim Pool Size=20;" //#endif //#endif }, //#endif + //#endif + //#if (AllStorage) + "DevOptions": { + "DbPlatform": "NoDb", //NoDb or EFCore + "EFProvider": "MSSQL" // SQLite, MSSQL, MySql, pgsql + }, + "ConnectionStrings": { + //EFCore SQLite + "SQLiteDbName": "appdata.db", + //EFCore MSSQL + "EntityFrameworkConnection": "Server=(localdb)\\mssqllocaldb;Database=WebApp-0353CAB0-205A-4FCD-9626-1282ECF47059;Trusted_Connection=True;MultipleActiveResultSets=true", + //EFCore MySql + "MySqlEntityFrameworkConnection": "Server=localhost;Database=yourdbname;Uid=yourdbuser;Pwd=yourdbpassword;Charset=utf8;", + //EFCore pgsql + "PostgreSqlEntityFrameworkConnection": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;Pooling=true;Minimum Pool Size=0;Maximim Pool Size=20;", + //#if (QueryTool) + //QueryTool should use a different connection string than the main app for security reasons (possibly readonly and no DDL commands) + "QueryToolConnectionString": "Data Source=appdata.db;Pooling=false;Mode=ReadWrite" //or one of the above + //#endif + }, + //#endif + "Logging": { "IncludeScopes": false, "LogLevel": { diff --git a/Content/WebApp/appsettings.json b/Content/WebApp/appsettings.json index 87fea3d..2592dd9 100644 --- a/Content/WebApp/appsettings.json +++ b/Content/WebApp/appsettings.json @@ -1,4 +1,5 @@ { + //#if (!AllStorage) //#if (!NoDb) "ConnectionStrings": { //#if (SQLite) @@ -11,10 +12,11 @@ "EntityFrameworkConnection": "Server=localhost;Database=yourdbname;Uid=yourdbuser;Pwd=yourdbpassword;Charset=utf8;", //#endif //#if (pgsql) - "EntityFrameworkConnection": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;", + "EntityFrameworkConnection": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;Pooling=true;Minimum Pool Size=0;Maximim Pool Size=20;", //#endif //#if (QueryTool) + //QueryTool should use a different connection string than the main app for security reasons (possibly readonly and no DDL commands) //#if (SQLite) "QueryToolConnectionString": "Data Source=appdata.db;Pooling=false;Mode=ReadWrite" //#endif @@ -25,11 +27,32 @@ "QueryToolConnectionString": "Server=localhost;Database=yourdbname;Uid=yourdbuser;Pwd=yourdbpassword;Charset=utf8;" //#endif //#if (pgsql) - "QueryToolConnectionString": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;" + "QueryToolConnectionString": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;Pooling=true;Minimum Pool Size=0;Maximim Pool Size=20;" //#endif //#endif }, + //#endif + //#endif + //#if (AllStorage) + "DevOptions": { + "DbPlatform": "NoDb", //NoDb or EFCore + "EFProvider": "MSSQL" // SQLite, MSSQL, MySql, pgsql + }, + "ConnectionStrings": { + //EFCore SQLite + "SQLiteDbName": "appdata.db", + //EFCore MSSQL + "EntityFrameworkConnection": "Server=(localdb)\\mssqllocaldb;Database=WebApp-0353CAB0-205A-4FCD-9626-1282ECF47059;Trusted_Connection=True;MultipleActiveResultSets=true", + //EFCore MySql + "MySqlEntityFrameworkConnection": "Server=localhost;Database=yourdbname;Uid=yourdbuser;Pwd=yourdbpassword;Charset=utf8;", + //EFCore pgsql + "PostgreSqlEntityFrameworkConnection": "Server=yourserver;Port=5432;User Id=youruser;Password=yourpassword;Database=yourdbname;Pooling=true;Minimum Pool Size=0;Maximim Pool Size=20;", + //#if (QueryTool) + //QueryTool should use a different connection string than the main app for security reasons (possibly readonly and no DDL commands) + "QueryToolConnectionString": "Data Source=appdata.db;Pooling=false;Mode=ReadWrite" //or one of the above + //#endif + }, //#endif "AppSettings": { diff --git a/Content/WebApp/changelog.txt b/Content/WebApp/changelog.txt deleted file mode 100644 index 1953621..0000000 --- a/Content/WebApp/changelog.txt +++ /dev/null @@ -1,10 +0,0 @@ -Cloudscribe Template Change Log -------------------------------- - - -Version 6.6 (not yet built) - -29 Aug 2023 - Added support for KVP properties to be rendered in user listing view -https://github.com/cloudscribe/cloudscribe.UserProperties.Kvp/issues/46 - - diff --git a/Content/WebApp/navigation.xml b/Content/WebApp/navigation.xml index 7a27b19..1072a50 100644 --- a/Content/WebApp/navigation.xml +++ b/Content/WebApp/navigation.xml @@ -877,6 +877,18 @@ + + + + cloudscribe.templates - 6.5.0 + 6.5.1 cloudscribe Project Templates Joe Audette Project template for starting new web application projects with cloudscribe library components @@ -10,7 +10,7 @@ Copyright © Exegesis Spatial Data Management en-US https://github.com/cloudscribe/cloudscribe.templates - https://licenses.nuget.org/Apache-2.0 + Apache-2.0 false @@ -21,6 +21,6 @@ - + diff --git a/cloudscribeTemplate/ProjectOptionsDialog.cs b/cloudscribeTemplate/ProjectOptionsDialog.cs index 0011e61..d3cc2c0 100644 --- a/cloudscribeTemplate/ProjectOptionsDialog.cs +++ b/cloudscribeTemplate/ProjectOptionsDialog.cs @@ -28,7 +28,8 @@ private void InitControls() new ComboItem{ Key = "SQLite", Text = "Use SQLite" }, new ComboItem{ Key = "MSSQL", Text = "Use Microsoft SqlServer" }, new ComboItem{ Key = "MySql", Text = "Use MySql" }, - new ComboItem{ Key = "pgsql", Text = "Use PostgreSql" } + new ComboItem{ Key = "pgsql", Text = "Use PostgreSql", + new ComboItem{ Key = "AllStorage", Text = "Use all database types (for developing new cloudscribe modules)" } }; cbDataStorage.ValueMember = "Key"; diff --git a/packtemplate.cmd b/packtemplate.cmd index d042549..f72b9cd 100644 --- a/packtemplate.cmd +++ b/packtemplate.cmd @@ -1 +1 @@ -nuget pack cloudscribe.templates.nuspec -Version 6.5.0 -OutputDirectory "nupkgs" +nuget pack cloudscribe.templates.nuspec -OutputDirectory "nupkgs" diff --git a/packtemplate.sh b/packtemplate.sh new file mode 100755 index 0000000..1ae1f84 --- /dev/null +++ b/packtemplate.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +nuget pack cloudscribe.templates.nuspec -OutputDirectory "nupkgs" -Properties Configuration=Release \ No newline at end of file diff --git a/testtemplates.sh b/testtemplates.sh new file mode 100755 index 0000000..c0fed10 --- /dev/null +++ b/testtemplates.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# the purpose of this script is to try and test the various template options +# to make sure that they produce valid cloudscribe projects that build and run + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +TESTPROJECTDIR="cloudscribe.templates.test" + +# this will build a new cloudscribe.templates nuget package and install it locally + +rm -Rf ./nupkgs 2>/dev/null +# create a new nuget package for the template +nuget pack cloudscribe.templates.nuspec -OutputDirectory "nupkgs" +[ $? -ne 0 ] && echo "nuget pack failed" && exit 1 + +#Uninstall any existing local version of the template +dotnet new --uninstall cloudscribe.templates +#Install the new version of the template we've just compiled +dotnet new --install ./nupkgs/*.nupkg + +# now we need to create a new project from the template and try and build it +# we'll use various options to test the different template options + +# this is a list of possibly useful combinations of options that we should test +# But how do I test all combinations because there is so many! +# As a start we'll just test the most common combinations +# some of which are not supported in NoDb or SQLite mode! + +# options for dotnet new cloudscribe -Da +DBOPTIONS="NoDb MSSQL MySql SQLite pgsql AllStorage" + +S=0 + +for DB in $DBOPTIONS; do + + echo "Building project with $DB database in $SCRIPT_DIR/$TESTPROJECTDIR ..." + + # cloudcribe module inclusions + MODULEOPTIONS="-C -K -I -Q -L -F -P -Ne -Co -Fo -D" + + # but some modules are not supported in NoDb or SQLite mode! + if [ $DB == "SQLite" ]; then + MODULEOPTIONS="-C -K -I -Q -L -F -Co -Fo -D" + fi + if [ $DB == "NoDb" ]; then + MODULEOPTIONS="-C -K -I -L -F -Co -Fo -D" + fi + + #remove and recreate the test project directory + rm -Rf $SCRIPT_DIR/$TESTPROJECTDIR 2>/dev/null + mkdir $SCRIPT_DIR/$TESTPROJECTDIR 2>/dev/null + + #if the test project directory exists, try and create a new project from the template + if [ -d "$SCRIPT_DIR/$TESTPROJECTDIR" ]; then + cd $SCRIPT_DIR/$TESTPROJECTDIR + dotnet new cloudscribe -Da $DB $MODULEOPTIONS + [ $? -ne 0 ] && echo "dotnet new failed" && break + dotnet restore --force --no-cache --force-evaluate + [ $? -ne 0 ] && echo "dotnet restore failed" && break + dotnet build + [ $? -ne 0 ] && echo "dotnet build failed" && break + cd $SCRIPT_DIR + S=$((S+1)) + fi + +done +rm -Rf $SCRIPT_DIR/$TESTPROJECTDIR 2>/dev/null + +echo "Successfully built $S/6 projects with various options!" +