diff --git a/SimplCommerce.sln b/SimplCommerce.sln index 78a141ca..1894b5e6 100644 --- a/SimplCommerce.sln +++ b/SimplCommerce.sln @@ -134,6 +134,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Module.Paymen EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimplCommerce.Module.PaymentCashfree", "src\Modules\SimplCommerce.Module.PaymentCashfree\SimplCommerce.Module.PaymentCashfree.csproj", "{E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecurityTest", "src\Modules\SecurityTest\SecurityTest.csproj", "{D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -696,6 +698,18 @@ Global {E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}.Release|x64.Build.0 = Release|Any CPU {E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}.Release|x86.ActiveCfg = Release|Any CPU {E30CF10F-FABF-4917-8BEB-CB81E4CE2C92}.Release|x86.Build.0 = Release|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Debug|x64.ActiveCfg = Debug|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Debug|x64.Build.0 = Debug|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Debug|x86.ActiveCfg = Debug|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Debug|x86.Build.0 = Debug|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Release|Any CPU.Build.0 = Release|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Release|x64.ActiveCfg = Release|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Release|x64.Build.0 = Release|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Release|x86.ActiveCfg = Release|Any CPU + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -750,6 +764,7 @@ Global {1A8B6FA0-8341-4D27-9B71-57F70AB37571} = {0A27C140-4CCB-40DD-BE48-F5DE16D1177B} {14586564-62CC-4117-AC1B-858ED53C2D6C} = {7EFA2FA7-32DD-4047-B021-50E77A83D714} {E30CF10F-FABF-4917-8BEB-CB81E4CE2C92} = {7EFA2FA7-32DD-4047-B021-50E77A83D714} + {D71E11B8-ED5B-4BE5-9663-26CF2AB6E7AB} = {7EFA2FA7-32DD-4047-B021-50E77A83D714} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B9D0D8F0-1AB9-44DD-839F-ED8CEE7DDB10} diff --git a/global.json b/global.json index 1e2c80a3..ee27cfc0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.100", + "version": "3.1.401", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Modules/SecurityTest/Class1.cs b/src/Modules/SecurityTest/Class1.cs new file mode 100644 index 00000000..93dfbb43 --- /dev/null +++ b/src/Modules/SecurityTest/Class1.cs @@ -0,0 +1,68 @@ +using System; +using System.Data; +using System.Text; +using Microsoft.Data.SqlClient; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; + +namespace SecurityTest +{ + public class Class1Options + { + public string ConnectionString { get; set; } + } + + public class Class1 + { + private readonly ILogger logger; + private readonly IOptions options; + + public Class1(ILogger logger, IOptions options) + { + this.logger = logger; + this.options = options; + } + + public void Method1(string title, string contents, string user) + { + var connection = new SqlConnection(); + var sb = new StringBuilder(); + try + { + connection.ConnectionString = options.Value.ConnectionString; + connection.Open(); + var insertSql = + string.Format("insert into BlogEntries (Title, Contents, Author, PostedDate) values ('{0}','{1}','{2}',{3:yyyy-MM-dd}); select top 1 * from blogentries order by Id desc;", + title, + contents, + user, + DateTime.Now); + + var insertCommand = new SqlCommand(insertSql, connection); + + var dataReader = insertCommand.ExecuteReader(); + + while (dataReader.Read()) { + var x = string.Format("Id:
{0}
Title:
{1}
Contents:
{2}
Author:
{3}
Posted date:
{4}
", + dataReader[0], + dataReader[1], + dataReader[2], + dataReader[3], + dataReader[4]); + sb.AppendLine(x); + } + } + catch (Exception ex) + { + logger.LogError(string.Format("A problem has occured. Please try again. Error={0}", ex.Message)); + } + finally + { + if (connection.State == ConnectionState.Open) + { + connection.Close(); + } + } + } + } +} diff --git a/src/Modules/SecurityTest/SecurityTest.csproj b/src/Modules/SecurityTest/SecurityTest.csproj new file mode 100644 index 00000000..5397106d --- /dev/null +++ b/src/Modules/SecurityTest/SecurityTest.csproj @@ -0,0 +1,11 @@ + + + + netcoreapp3.1 + + + + + + + diff --git a/src/Modules/SimplCommerce.Module.SampleData/SimplCommerce.Module.SampleData.csproj b/src/Modules/SimplCommerce.Module.SampleData/SimplCommerce.Module.SampleData.csproj index 087e015e..70e5b97c 100644 --- a/src/Modules/SimplCommerce.Module.SampleData/SimplCommerce.Module.SampleData.csproj +++ b/src/Modules/SimplCommerce.Module.SampleData/SimplCommerce.Module.SampleData.csproj @@ -10,9 +10,6 @@ - + diff --git a/src/Modules/SimplCommerce.Module.StorageAzureBlob/SimplCommerce.Module.StorageAzureBlob.csproj b/src/Modules/SimplCommerce.Module.StorageAzureBlob/SimplCommerce.Module.StorageAzureBlob.csproj index 4057efaa..b64b4a30 100644 --- a/src/Modules/SimplCommerce.Module.StorageAzureBlob/SimplCommerce.Module.StorageAzureBlob.csproj +++ b/src/Modules/SimplCommerce.Module.StorageAzureBlob/SimplCommerce.Module.StorageAzureBlob.csproj @@ -1,7 +1,7 @@ - +