diff --git a/.gitignore b/.gitignore index ecc8fa5..3036c8b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ project.lock.json .DS_Store *.pyc nupkg/ +.idea # Visual Studio Code .vscode diff --git a/DynamORM.Tests/DynamORM.Tests.Mono.csproj b/DynamORM.Tests/DynamORM.Tests.Mono.csproj deleted file mode 100644 index 28fd64d..0000000 --- a/DynamORM.Tests/DynamORM.Tests.Mono.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764} - Library - Properties - DynamORM.Tests - DynamORM.Tests - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE;MONO - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;MONO - prompt - 4 - - - - - - - - - - - False - nunit - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - {63963ED7-9C78-4672-A4D4-339B6E825503} - DynamORM - - - - - diff --git a/DynamORM.Tests/DynamORM.Tests.csproj b/DynamORM.Tests/DynamORM.Tests.csproj index ca38ca4..251b8aa 100644 --- a/DynamORM.Tests/DynamORM.Tests.csproj +++ b/DynamORM.Tests/DynamORM.Tests.csproj @@ -1,138 +1,44 @@ - - + + - Debug - AnyCPU - 8.0.30703 - 2.0 - {D5013B4E-8A1B-4DBB-8FB5-E09935F4F764} + net8.0 + Dynamic Object-Relational Mapping tests library. + Copyright © RUSSEK Software 2012-2024 + RUSSEK Software + Grzegorz Russek + 1.8 + https://git.dr4cul4.pl/RUSSEK-Software/DynamORM + https://dr4cul4.pl + DynamORM + MIT Library - Properties - DynamORM.Tests - DynamORM.Tests - v4.8 - 512 - - False - False - false - obj\$(Configuration)\ - False - False - OnBuildSuccess - - - PackageReference + false + enable - - Full - False - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - 4194304 - False - Auto - False - AnyCPU - PackageReference - - - PdbOnly - true - bin\Release\ - TRACE - prompt - 4 - 4194304 - False - Auto - False - AnyCPU - PackageReference - - - 4194304 - AnyCPU - False - Auto - False - PackageReference - - - False - PackageReference - - - False - PackageReference - - - - - - - - - + + + + - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - + + - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - + + + + + + - - {63963ED7-9C78-4672-A4D4-339B6E825503} - DynamORM - + + + - - 3.3.1 - - - 3.3.1 - - - 1.0.118 - + + - - \ No newline at end of file diff --git a/DynamORM.Tests/Properties/AssemblyInfo.cs b/DynamORM.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index ce5b32b..0000000 --- a/DynamORM.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * DynamORM - Dynamic Object-Relational Mapping library. - * Copyright (c) 2012-2015, Grzegorz Russek (grzegorz.russek@gmail.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - * See: http://opensource.org/licenses/bsd-license.php -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("DynamORM.Tests")] -[assembly: AssemblyDescription("Dynamic Object-Relational Mapping tests library.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("RUSSEK Software")] -[assembly: AssemblyProduct("DynamORM")] -[assembly: AssemblyCopyright("Copyright © RUSSEK Software 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1d8b751b-b3ec-481d-9f7f-14d6e6eb0fde")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.1")] -[assembly: AssemblyFileVersion("1.1.0.1")] \ No newline at end of file diff --git a/DynamORM.Tests/Select/RenamedTypedAccessTests.cs b/DynamORM.Tests/Select/RenamedTypedAccessTests.cs index 3ea71f4..a90b7b8 100644 --- a/DynamORM.Tests/Select/RenamedTypedAccessTests.cs +++ b/DynamORM.Tests/Select/RenamedTypedAccessTests.cs @@ -29,16 +29,16 @@ using System.Collections.Generic; using System.Linq; using DynamORM.Tests.Helpers; -using NUnit.Framework; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace DynamORM.Tests.Select { /// Test typed ORM. - [TestFixture] + [TestClass] public class RenamedTypedAccessTests : TypedAccessTests { /// Test something fancy... like: select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;. - [Test] + [TestMethod] public override void TestTypedFancyAggregateQuery() { var v = (GetTestTable().Query(type: typeof(Users), columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable).ToList(); @@ -53,7 +53,7 @@ namespace DynamORM.Tests.Select } /// Test something fancy... like: select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;. - [Test] + [TestMethod] public override void TestGenericFancyAggregateQuery() { var v = (GetTestTable().Query(columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable).ToList(); @@ -68,21 +68,21 @@ namespace DynamORM.Tests.Select } /// Test typed First method. - [Test] + [TestMethod] public override void TestTypedFirst() { Assert.AreEqual(1, GetTestTable().First(type: typeof(Users), columns: "id").Id); } /// Test typed Last method. - [Test] + [TestMethod] public override void TestTypedLast() { Assert.AreEqual(200, GetTestTable().Last(type: typeof(Users), columns: "id").Id); } /// Test typed Single multi. - [Test] + [TestMethod] public override void TestTypedSingleObject() { var exp = new { id = 19, first = "Ori", last = "Ellis" }; @@ -94,35 +94,35 @@ namespace DynamORM.Tests.Select } /// Test typed where expression equal. - [Test] + [TestMethod] public override void TestTypedWhereEq() { Assert.AreEqual("hoyt.tran", GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("id").Eq(100)).Login); } /// Test typed where expression like. - [Test] + [TestMethod] public override void TestTypedWhereLike() { Assert.AreEqual(100, GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("login").Like("Hoyt.%")).Id); } /// Test generic First method. - [Test] + [TestMethod] public override void TestGenericFirst() { Assert.AreEqual(1, GetTestTable().First(columns: "id").Id); } /// Test generic Last method. - [Test] + [TestMethod] public override void TestGenericLast() { Assert.AreEqual(200, GetTestTable().Last(columns: "id").Id); } /// Test generic Single multi. - [Test] + [TestMethod] public override void TestGenericSingleObject() { var exp = new { id = 19, first = "Ori", last = "Ellis" }; @@ -134,14 +134,14 @@ namespace DynamORM.Tests.Select } /// Test generic where expression equal. - [Test] + [TestMethod] public override void TestGenericWhereEq() { Assert.AreEqual("hoyt.tran", GetTestTable().Single(where: new DynamicColumn("id").Eq(100)).Login); } /// Test generic where expression like. - [Test] + [TestMethod] public override void TestGenericWhereLike() { Assert.AreEqual(100, GetTestTable().Single(where: new DynamicColumn("login").Like("Hoyt.%")).Id); diff --git a/DynamORM.Tests/Select/TypedAccessTests.cs b/DynamORM.Tests/Select/TypedAccessTests.cs index 485a6e0..e1d2bc0 100644 --- a/DynamORM.Tests/Select/TypedAccessTests.cs +++ b/DynamORM.Tests/Select/TypedAccessTests.cs @@ -127,7 +127,7 @@ namespace DynamORM.Tests.Select Assert.AreEqual(200, GetTestBuilder() .From(x => x(typeof(T)).As(x.t)) .Select(x => x.Count(x.t.id)) - .Scalar()); + .ScalarAs()); } /// Test count with in statement. @@ -149,7 +149,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.last.In(new object[] { "Hendricks", "Goodwin", "Freeman" }.Take(3))) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test count with in statement. @@ -171,7 +171,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.last.In(new object[] { "Hendricks", "Goodwin", "Freeman" })) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed First method. @@ -231,7 +231,7 @@ namespace DynamORM.Tests.Select Assert.AreEqual(1, GetTestBuilder() .From(x => x(typeof(T)).As(x.t)) .Select(x => x.Min(x.t.id)) - .Scalar()); + .ScalarAs()); } /// Test typed Min method. @@ -248,7 +248,7 @@ namespace DynamORM.Tests.Select Assert.AreEqual(200, GetTestBuilder() .From(x => x(typeof(T)).As(x.t)) .Select(x => x.Max(x.t.id)) - .Scalar()); + .ScalarAs()); } /// Test typed Min method. @@ -282,7 +282,7 @@ namespace DynamORM.Tests.Select Assert.AreEqual(20100, GetTestBuilder() .From(x => x(typeof(T)).As(x.t)) .Select(x => x.Sum(x.t.id)) - .Scalar()); + .ScalarAs()); } /// Test typed Scalar method for invalid operation exception. @@ -516,7 +516,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id != 100) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression like. @@ -550,7 +550,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.login.NotLike("Hoyt.%")) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression not like. @@ -561,7 +561,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => !x.t.login.Like("Hoyt.%")) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression greater. @@ -579,7 +579,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id > 100) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression greater or equal. @@ -597,7 +597,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id >= 100) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression less. @@ -615,7 +615,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id < 100) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression less or equal. @@ -633,7 +633,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id <= 100) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression between. @@ -651,7 +651,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id.Between(75, 100)) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression in parameters. @@ -676,7 +676,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id.In(75, 99, 100)) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } /// Test typed where expression in array. @@ -687,7 +687,7 @@ namespace DynamORM.Tests.Select .From(x => x(typeof(T)).As(x.t)) .Where(x => x.t.id.In(new[] { 75, 99, 100 })) .Select(x => x.Count()) - .Scalar()); + .ScalarAs()); } #endregion Where typed diff --git a/DynamORM/DynamicQueryException.cs b/DynamORM/DynamicQueryException.cs index a1487a6..e4c1a2d 100644 --- a/DynamORM/DynamicQueryException.cs +++ b/DynamORM/DynamicQueryException.cs @@ -71,32 +71,5 @@ namespace DynamORM : base(string.Format("{0}{1}{2}", message, Environment.NewLine, command != null ? command.DumpToString() : string.Empty), innerException) { } - - /// Initializes a new instance of the - /// class. - /// The - /// that holds the serialized object data about the exception being thrown. - /// The - /// that contains contextual information about the source or destination. - public DynamicQueryException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - - /// When overridden in a derived class, sets the - /// - /// with information about the exception. - /// The - /// that holds the serialized object data about the exception being thrown. - /// The - /// that contains contextual information about the source or destination. - /// - /// - /// - /// - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - } } } \ No newline at end of file diff --git a/DynamORM/Helpers/Dynamics/DynamicParser.cs b/DynamORM/Helpers/Dynamics/DynamicParser.cs index 4a87584..c045a56 100644 --- a/DynamORM/Helpers/Dynamics/DynamicParser.cs +++ b/DynamORM/Helpers/Dynamics/DynamicParser.cs @@ -1395,7 +1395,7 @@ namespace DynamORM.Helpers.Dynamics catch (TargetInvocationException e) { if (e.InnerException != null) throw e.InnerException; - else throw e; + throw; } } diff --git a/DynamORM/Mapper/DynamicMapperException.cs b/DynamORM/Mapper/DynamicMapperException.cs index 27ec2b8..6f131f3 100644 --- a/DynamORM/Mapper/DynamicMapperException.cs +++ b/DynamORM/Mapper/DynamicMapperException.cs @@ -24,12 +24,5 @@ namespace DynamORM.Mapper public DynamicMapperException(string message, Exception innerException) : base(message, innerException) { } - - /// Initializes a new instance of the class. - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected DynamicMapperException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } } } \ No newline at end of file