Merge branch 'modernize/tests-and-amalgamation'

This commit is contained in:
root
2026-02-26 15:33:52 +01:00
36 changed files with 18218 additions and 19793 deletions

View File

@@ -1,63 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A64D2052-D0CD-488E-BF05-E5952615D926}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AmalgamationTool</RootNamespace>
<AssemblyName>AmalgamationTool</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DynamORM.Amalgamation.cs">
<ExcludeFromStyleCop>True</ExcludeFromStyleCop>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="DynamORM.Amalgamation.cs" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -1,192 +1,261 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace AmalgamationTool
{
internal class Program
{
private static void Main(string[] args)
{
List<string> usings = new List<string>();
Dictionary<string, List<string>> classes = new Dictionary<string, List<string>>();
// Build a file using string builder.
StringBuilder sb = new StringBuilder();
foreach (var f in new DirectoryInfo(Path.GetFullPath(args[0].Trim('"', '\''))).GetFiles("*.cs", SearchOption.AllDirectories))
{
string content = File.ReadAllText(f.FullName);
string namespaceName = string.Empty;
// Deal with usings
foreach (var u in content.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)
.Where(l => l.Trim().StartsWith("using ") && !l.Trim().StartsWith("using ("))
.Select(l => l.Trim()))
if (!usings.Contains(u))
usings.Add(u);
// Extract namespace
//if (args.Length > 2)
//{
// var tcontent = Regex.Replace(content, @"^\s*using\s+.*\s*;$", string.Empty);
// tcontent = Regex.Replace(content, @"^\s*namespace\s+.*\s*", string.Empty).Trim();
// var ns = Regex.Match(content, @"^\s*namespace\s+(?<ns>.*)\s*");
// if (ns.Success)
// {
// if (!classes.ContainsKey(ns.Groups["ns"].Value))
// classes.Add(ns.Groups["ns"].Value, new List<string>());
// classes[ns.Groups["ns"].Value].Add(tcontent);
// }
//}
//else
{
if (content.Trim().Length == 0)
continue;
var nstart = content.IndexOf("namespace ") + "namespace ".Length;
var bbrace = content.IndexOf("{", nstart);
var nlen = bbrace - nstart;
if (nstart < "namespace ".Length)
{
if (f.Name.ToLower() == "assemblyinfo.cs")
{
var hs = content.IndexOf("/*");
var es = content.IndexOf("*/", hs) + 2;
if (es > hs)
{
sb.AppendLine(content.Substring(hs, es - hs));
sb.AppendLine();
}
}
continue;
}
string ns = content.Substring(nstart, nlen).Trim();
// Add namespace if not exist
if (!classes.ContainsKey(ns))
classes.Add(ns, new List<string>());
var ebrace = content.LastIndexOf('}');
// Cut content as class/enum
classes[ns].Add(content.Substring(bbrace + 1, ebrace - bbrace - 1));
}
}
usings.Sort();
foreach (var u in usings)
sb.AppendLine(u);
sb.AppendLine(@"
[module: System.Diagnostics.CodeAnalysis.SuppressMessage(""StyleCop.CSharp.MaintainabilityRules"", ""SA1402:FileMayOnlyContainASingleClass"", Justification = ""This is a generated file which generates all the necessary support classes."")]
[module: System.Diagnostics.CodeAnalysis.SuppressMessage(""StyleCop.CSharp.MaintainabilityRules"", ""SA1403:FileMayOnlyContainASingleNamespace"", Justification = ""This is a generated file which generates all the necessary support classes."")]");
FillClassesAndNamespacesIddented(classes, sb);
string amalgamation = sb.ToString();
sb = new StringBuilder();
string prevTrimmed = null;
string[] array = amalgamation.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
for (int i = 0; i < array.Length; i++)
{
string l = array[i];
var currentTrimmed = l.Trim();
var nextTrimmed = (i + 1 == array.Length) ? null : array[i + 1].Trim();
if (prevTrimmed != null)
{
switch (prevTrimmed)
{
case "":
if (currentTrimmed == string.Empty)
continue;
break;
case "{":
case "}":
if (currentTrimmed == string.Empty && (nextTrimmed == prevTrimmed || nextTrimmed == string.Empty))
continue;
break;
}
}
sb.AppendLine(l);
prevTrimmed = currentTrimmed;
}
File.WriteAllText(Path.GetFullPath(args[1].Trim('"', '\'')), sb.ToString());
}
private static void FillClassesAndNamespaces(Dictionary<string, List<string>> classes, StringBuilder sb)
{
foreach (var n in classes)
{
sb.AppendFormat("namespace {0}{1}{{", n.Key, Environment.NewLine);
n.Value.ForEach(c => sb.Append(c));
sb.AppendLine("}");
sb.AppendLine(string.Empty);
}
}
private static void FillClassesAndNamespacesIddented(Dictionary<string, List<string>> classes, StringBuilder sb)
{
var min = classes.Min(k => k.Key.Split('.').Count());
foreach (var n in classes.Where(nc => nc.Key.Split('.').Count() == min))
{
sb.AppendFormat("namespace {0}{1}{{", n.Key, Environment.NewLine);
n.Value.ForEach(c => sb.Append(c));
SubNamespaces(classes, n.Key, sb, min);
sb.AppendLine("}");
sb.AppendLine(string.Empty);
}
}
private static void SubNamespaces(Dictionary<string, List<string>> classes, string p, StringBuilder sb, int ident)
{
sb.AppendLine(string.Empty);
foreach (var n in classes.Where(nc => nc.Key.Split('.').Count() == ident + 1 && nc.Key.StartsWith(p)))
{
for (int i = 0; i < ident; i++) sb.Append(" ");
sb.AppendFormat("namespace {0}{1}", n.Key.Substring(p.Length + 1), Environment.NewLine);
for (int i = 0; i < ident; i++) sb.Append(" ");
sb.Append("{");
n.Value.ForEach(c =>
{
foreach (var l in c.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
{
for (int i = 0; i < ident; i++) sb.Append(" ");
sb.AppendLine(l);
}
});
SubNamespaces(classes, n.Key, sb, ident + 1);
for (int i = 0; i < ident; i++) sb.Append(" ");
sb.AppendLine("}");
sb.AppendLine(string.Empty);
}
}
}
}
using System.Text;
using System.Text.RegularExpressions;
namespace AmalgamationTool;
internal static class Program
{
private const string NamespaceToken = "namespace ";
private static int Main(string[] args)
{
if (args.Length < 2)
{
Console.Error.WriteLine("Usage: AmalgamationTool <sourceDir> <outputFile>");
return 1;
}
var sourceDir = Path.GetFullPath(args[0].Trim('"', '\''));
var outputFile = Path.GetFullPath(args[1].Trim('"', '\''));
if (!Directory.Exists(sourceDir))
{
Console.Error.WriteLine($"Source directory not found: {sourceDir}");
return 2;
}
var allUsings = new SortedSet<string>(StringComparer.Ordinal);
var namespaces = new SortedDictionary<string, List<string>>(StringComparer.Ordinal);
var headerComment = string.Empty;
foreach (var file in EnumerateInputFiles(sourceDir))
{
var content = File.ReadAllText(file);
if (string.IsNullOrWhiteSpace(content))
{
continue;
}
if (string.IsNullOrEmpty(headerComment))
{
headerComment = TryGetFileHeaderComment(content);
}
foreach (var @using in ExtractUsingLines(content))
{
allUsings.Add(@using);
}
var nsData = TryExtractNamespaceBody(content);
if (nsData == null)
{
continue;
}
if (!namespaces.TryGetValue(nsData.Value.Namespace, out var nodes))
{
nodes = new List<string>();
namespaces[nsData.Value.Namespace] = nodes;
}
nodes.Add(nsData.Value.Body);
}
var output = BuildAmalgamation(headerComment, allUsings, namespaces);
Directory.CreateDirectory(Path.GetDirectoryName(outputFile) ?? ".");
File.WriteAllText(outputFile, output, new UTF8Encoding(false));
Console.WriteLine($"Amalgamation generated: {outputFile}");
return 0;
}
private static IEnumerable<string> EnumerateInputFiles(string sourceDir)
{
var root = new DirectoryInfo(sourceDir);
return root.EnumerateFiles("*.cs", SearchOption.AllDirectories)
.Where(f => !f.FullName.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}", StringComparison.OrdinalIgnoreCase))
.Where(f => !f.FullName.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}", StringComparison.OrdinalIgnoreCase))
.Where(f => !f.Name.Equals("AssemblyInfo.cs", StringComparison.OrdinalIgnoreCase))
.Where(f => !f.Name.Equals("DynamORM.Amalgamation.cs", StringComparison.OrdinalIgnoreCase))
.Select(f => f.FullName)
.OrderBy(f => f, StringComparer.Ordinal);
}
private static IEnumerable<string> ExtractUsingLines(string content)
{
var matches = Regex.Matches(content, @"^\s*using\s+[^;]+;", RegexOptions.Multiline);
foreach (Match match in matches)
{
var line = match.Value.Trim();
if (!line.StartsWith("using (", StringComparison.Ordinal))
{
yield return line;
}
}
}
private static (string Namespace, string Body)? TryExtractNamespaceBody(string content)
{
var nsIndex = content.IndexOf(NamespaceToken, StringComparison.Ordinal);
if (nsIndex < 0)
{
return null;
}
var nsStart = nsIndex + NamespaceToken.Length;
var braceStart = content.IndexOf('{', nsStart);
if (braceStart < 0)
{
return null;
}
var namespaceName = content.Substring(nsStart, braceStart - nsStart).Trim();
if (string.IsNullOrWhiteSpace(namespaceName))
{
return null;
}
var braceEnd = FindMatchingBrace(content, braceStart);
if (braceEnd <= braceStart)
{
return null;
}
var body = content.Substring(braceStart + 1, braceEnd - braceStart - 1).Trim('\r', '\n');
return (namespaceName, body);
}
private static int FindMatchingBrace(string content, int openBrace)
{
var depth = 0;
for (var i = openBrace; i < content.Length; i++)
{
switch (content[i])
{
case '{':
depth++;
break;
case '}':
depth--;
if (depth == 0)
{
return i;
}
break;
}
}
return -1;
}
private static string TryGetFileHeaderComment(string content)
{
var match = Regex.Match(content, @"^\s*/\*.*?\*/", RegexOptions.Singleline);
return match.Success ? match.Value.Trim() : string.Empty;
}
private static string BuildAmalgamation(
string headerComment,
IEnumerable<string> allUsings,
SortedDictionary<string, List<string>> namespaces)
{
var sb = new StringBuilder();
if (!string.IsNullOrWhiteSpace(headerComment))
{
sb.AppendLine(headerComment);
sb.AppendLine();
}
foreach (var @using in allUsings)
{
sb.AppendLine(@using);
}
sb.AppendLine();
sb.AppendLine("[module: System.Diagnostics.CodeAnalysis.SuppressMessage(\"StyleCop.CSharp.MaintainabilityRules\", \"SA1402:FileMayOnlyContainASingleClass\", Justification = \"This is a generated file which generates all the necessary support classes.\")]");
sb.AppendLine("[module: System.Diagnostics.CodeAnalysis.SuppressMessage(\"StyleCop.CSharp.MaintainabilityRules\", \"SA1403:FileMayOnlyContainASingleNamespace\", Justification = \"This is a generated file which generates all the necessary support classes.\")]");
sb.AppendLine();
FillNamespaceTree(namespaces, sb);
return CleanupWhitespace(sb.ToString());
}
private static void FillNamespaceTree(SortedDictionary<string, List<string>> classes, StringBuilder sb)
{
var minDepth = classes.Keys.Min(k => k.Split('.').Length);
foreach (var root in classes.Where(c => c.Key.Split('.').Length == minDepth))
{
sb.AppendLine($"namespace {root.Key}");
sb.AppendLine("{");
foreach (var code in root.Value)
{
sb.AppendLine(code);
}
FillSubNamespaces(classes, root.Key, minDepth, sb);
sb.AppendLine("}");
sb.AppendLine();
}
}
private static void FillSubNamespaces(
SortedDictionary<string, List<string>> classes,
string parent,
int depth,
StringBuilder sb)
{
foreach (var child in classes.Where(c => c.Key.StartsWith(parent + ".", StringComparison.Ordinal) && c.Key.Split('.').Length == depth + 1))
{
var indent = new string(' ', depth * 4);
var shortNamespace = child.Key.Substring(parent.Length + 1);
sb.Append(indent).AppendLine($"namespace {shortNamespace}");
sb.Append(indent).AppendLine("{");
foreach (var block in child.Value)
{
foreach (var line in block.Replace("\r\n", "\n").Split('\n'))
{
sb.Append(indent).Append(" ").AppendLine(line);
}
}
FillSubNamespaces(classes, child.Key, depth + 1, sb);
sb.Append(indent).AppendLine("}");
sb.AppendLine();
}
}
private static string CleanupWhitespace(string content)
{
var lines = content.Replace("\r\n", "\n").Split('\n');
var output = new StringBuilder();
string? previous = null;
for (var i = 0; i < lines.Length; i++)
{
var current = lines[i];
var trimmed = current.Trim();
var nextTrimmed = i + 1 < lines.Length ? lines[i + 1].Trim() : null;
if (string.IsNullOrEmpty(trimmed))
{
if (string.IsNullOrEmpty(previous))
{
continue;
}
if (previous == "{" || previous == "}" || nextTrimmed == "}" || string.IsNullOrEmpty(nextTrimmed))
{
continue;
}
}
output.AppendLine(current.TrimEnd());
previous = trimmed;
}
return output.ToString();
}
}

View File

@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("AmalgamationTool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("AmalgamationTool")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
[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("de540809-dd27-47b1-bb01-7dce3a880cde")]
// 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.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Description>Dynamic Object-Relational Mapping tests library.</Description>
<Copyright>Copyright © RUSSEK Software 2012-2026</Copyright>
<Company>RUSSEK Software</Company>
@@ -25,13 +25,13 @@
<ProjectReference Include="..\DynamORM\DynamORM.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1"/>
<PackageReference Include="MSTest.TestFramework" Version="3.1.1"/>
<PackageReference Include="System.Data.SQLite" Version="1.0.119" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="NUnit" Version="3.14.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/>
<PackageReference Include="System.Data.SQLite" Version="1.0.119" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="Helpers\**" />

View File

@@ -1,64 +1,64 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Helpers
{
/// <summary>Class responsible for users operations testing.</summary>
[TestClass]
public class AttachToDebugger
{
/// <summary>Test anonymous type compatibility.</summary>
[TestMethod]
public void TestAnonType()
{
var a = new { x = 1, y = 2 };
var b = new { x = 3, y = 4 };
Assert.AreEqual(a.GetType(), b.GetType());
}
/// <summary>Test anonymous type value.</summary>
[TestMethod]
public void TestAnonTypeValue()
{
var a = new { x = 1, y = "bla bla" };
var b = new { x = 1, y = "bla bla" };
Assert.AreEqual(a, b);
Assert.IsTrue(a.Equals(b));
Dictionary<object, int> dict = new Dictionary<object, int>() { { a, 999 } };
Assert.IsTrue(dict.ContainsKey(b));
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Collections.Generic;
using System.Diagnostics;
using NUnit.Framework;
namespace DynamORM.Tests.Helpers
{
/// <summary>Class responsible for sample_users operations testing.</summary>
[TestFixture]
public class AttachToDebugger
{
/// <summary>Test anonymous type compatibility.</summary>
[Test]
public void TestAnonType()
{
var a = new { x = 1, y = 2 };
var b = new { x = 3, y = 4 };
Assert.AreEqual(a.GetType(), b.GetType());
}
/// <summary>Test anonymous type value.</summary>
[Test]
public void TestAnonTypeValue()
{
var a = new { x = 1, y = "bla bla" };
var b = new { x = 1, y = "bla bla" };
Assert.AreEqual(a, b);
Assert.IsTrue(a.Equals(b));
Dictionary<object, int> dict = new Dictionary<object, int>() { { a, 999 } };
Assert.IsTrue(dict.ContainsKey(b));
}
}
}

View File

@@ -1,121 +1,121 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System;
using DynamORM.Helpers.Dynamics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Helpers.Dynamic
{
/// <summary><see cref="DynamicParser"/> tests.</summary>
[TestClass]
public class DynamicParserTests
{
/// <summary>
/// Tests the get member.
/// </summary>
[TestMethod]
public void TestGetMember()
{
Func<dynamic, object> f = x => x.SomePropery;
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.GetMember;
Assert.IsNotNull(val);
Assert.AreEqual("SomePropery", val.Name);
}
/// <summary>
/// Tests the set member.
/// </summary>
[TestMethod]
public void TestSetMember()
{
Func<dynamic, object> f = x => x.SomePropery = "value";
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.SetMember;
Assert.IsNotNull(val);
Assert.AreEqual("SomePropery", val.Name);
Assert.AreEqual("value", val.Value);
}
/// <summary>
/// Tests the index of the get.
/// </summary>
[TestMethod]
public void TestGetIndex()
{
Func<dynamic, object> f = x => x.SomePropery[0];
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.GetIndex;
Assert.IsNotNull(val);
}
/// <summary>
/// Tests the index of the set.
/// </summary>
[TestMethod]
public void TestSetIndex()
{
Func<dynamic, object> f = x => x.SomePropery[0] = "value";
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.SetIndex;
Assert.IsNotNull(val);
Assert.AreEqual("value", val.Value);
}
/// <summary>
/// Tests something.
/// </summary>
[TestMethod]
public void TestSomething()
{
Func<dynamic, object> f = x => x.SomePropery == "value" || x.OtherProperty == -1;
var p = DynamicParser.Parse(f);
var val = p.Result as DynamicParser.Node.Binary;
Assert.IsNotNull(val);
var left = val.Host as DynamicParser.Node.Binary;
var right = val.Right as DynamicParser.Node.Binary;
Assert.IsNotNull(left);
Assert.IsNotNull(right);
Assert.IsInstanceOfType(left.Host, typeof(DynamicParser.Node.GetMember));
Assert.IsInstanceOfType(right.Host, typeof(DynamicParser.Node.GetMember));
Assert.AreEqual("value", left.Right);
Assert.AreEqual(-1, right.Right);
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System;
using DynamORM.Helpers.Dynamics;
using NUnit.Framework;
namespace DynamORM.Tests.Helpers.Dynamic
{
/// <summary><see cref="DynamicParser"/> tests.</summary>
[TestFixture]
public class DynamicParserTests
{
/// <summary>
/// Tests the get member.
/// </summary>
[Test]
public void TestGetMember()
{
Func<dynamic, object> f = x => x.SomePropery;
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.GetMember;
Assert.IsNotNull(val);
Assert.AreEqual("SomePropery", val.Name);
}
/// <summary>
/// Tests the set member.
/// </summary>
[Test]
public void TestSetMember()
{
Func<dynamic, object> f = x => x.SomePropery = "value";
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.SetMember;
Assert.IsNotNull(val);
Assert.AreEqual("SomePropery", val.Name);
Assert.AreEqual("value", val.Value);
}
/// <summary>
/// Tests the index of the get.
/// </summary>
[Test]
public void TestGetIndex()
{
Func<dynamic, object> f = x => x.SomePropery[0];
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.GetIndex;
Assert.IsNotNull(val);
}
/// <summary>
/// Tests the index of the set.
/// </summary>
[Test]
public void TestSetIndex()
{
Func<dynamic, object> f = x => x.SomePropery[0] = "value";
var val = DynamicParser.Parse(f).Result as DynamicParser.Node.SetIndex;
Assert.IsNotNull(val);
Assert.AreEqual("value", val.Value);
}
/// <summary>
/// Tests something.
/// </summary>
[Test]
public void TestSomething()
{
Func<dynamic, object> f = x => x.SomePropery == "value" || x.OtherProperty == -1;
var p = DynamicParser.Parse(f);
var val = p.Result as DynamicParser.Node.Binary;
Assert.IsNotNull(val);
var left = val.Host as DynamicParser.Node.Binary;
var right = val.Right as DynamicParser.Node.Binary;
Assert.IsNotNull(left);
Assert.IsNotNull(right);
Assert.IsInstanceOf<DynamicParser.Node.GetMember>(left.Host);
Assert.IsInstanceOf<DynamicParser.Node.GetMember>(right.Host);
Assert.AreEqual("value", left.Right);
Assert.AreEqual(-1, right.Right);
}
}
}

View File

@@ -1,100 +1,100 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Helpers
{
/// <summary>Pooling tests.</summary>
[TestClass]
public class PoolingTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[TestInitialize]
public virtual void SetUp()
{
CreateTestDatabase();
}
/// <summary>Tear down test objects.</summary>
[TestCleanup]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
/// <summary>Test single mode command disposing.</summary>
[TestMethod]
public void TestSingleModeCommand()
{
CreateDynamicDatabase();
var cmd = Database.Open().CreateCommand();
cmd.SetCommand("SELECT COUNT(0) FROM sqlite_master;");
Database.Dispose();
Database = null;
Assert.ThrowsException<DynamicQueryException>(() => cmd.ExecuteScalar());
}
/// <summary>Test single mode transaction disposing.</summary>
[TestMethod]
public void TestSingleModeTransaction()
{
try
{
CreateDynamicDatabase();
using (var conn = Database.Open())
using (var trans = conn.BeginTransaction())
using (var cmd = conn.CreateCommand())
{
Assert.AreEqual(1, cmd.SetCommand("INSERT INTO \"users\" (\"code\") VALUES ('999');").ExecuteNonQuery());
Database.Dispose();
Database = null;
trans.Commit();
}
// Verify (rollback)
CreateDynamicDatabase();
Assert.AreEqual(0, Database.Table("users").Count(columns: "id", code: "999"));
}
finally
{
// Remove for next tests
Database.Dispose();
Database = null;
}
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using NUnit.Framework;
namespace DynamORM.Tests.Helpers
{
/// <summary>Pooling tests.</summary>
[TestFixture]
public class PoolingTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[SetUp]
public virtual void SetUp()
{
CreateTestDatabase();
}
/// <summary>Tear down test objects.</summary>
[TearDown]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
/// <summary>Test single mode command disposing.</summary>
[Test]
public void TestSingleModeCommand()
{
CreateDynamicDatabase();
var cmd = Database.Open().CreateCommand();
cmd.SetCommand("SELECT COUNT(0) FROM sqlite_master;");
Database.Dispose();
Database = null;
Assert.Throws<DynamicQueryException>(() => cmd.ExecuteScalar());
}
/// <summary>Test single mode transaction disposing.</summary>
[Test]
public void TestSingleModeTransaction()
{
try
{
CreateDynamicDatabase();
using (var conn = Database.Open())
using (var trans = conn.BeginTransaction())
using (var cmd = conn.CreateCommand())
{
Assert.AreEqual(1, cmd.SetCommand("INSERT INTO \"sample_users\" (\"code\") VALUES ('999');").ExecuteNonQuery());
Database.Dispose();
Database = null;
trans.Commit();
}
// Verify (rollback)
CreateDynamicDatabase();
Assert.AreEqual(0, Database.Table("sample_users").Count(columns: "id", code: "999"));
}
finally
{
// Remove for next tests
Database.Dispose();
Database = null;
}
}
}
}

View File

@@ -1,73 +1,73 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using DynamORM.Mapper;
namespace DynamORM.Tests.Helpers
{
/// <summary>Users table representation.</summary>
[Table(Name = "users", Override = true)]
public class Users
{
/// <summary>Gets or sets id column value.</summary>
[Column("id", true)]
public long Id { get; set; }
/// <summary>Gets or sets code column value.</summary>
[Column("code")]
public string Code { get; set; }
/// <summary>Gets or sets login column value.</summary>
[Column("login")]
public string Login { get; set; }
/// <summary>Gets or sets first column value.</summary>
[Column("first")]
public string First { get; set; }
/// <summary>Gets or sets last column value.</summary>
[Column("last")]
public string Last { get; set; }
/// <summary>Gets or sets password column value.</summary>
[Column("password")]
public string Password { get; set; }
/// <summary>Gets or sets email column value.</summary>
[Column("email")]
public string Email { get; set; }
/// <summary>Gets or sets quote column value.</summary>
[Column("quote")]
public string Quote { get; set; }
/// <summary>Gets or sets value of aggregate fields.</summary>
[Ignore]
public object AggregateField { get; set; }
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using DynamORM.Mapper;
namespace DynamORM.Tests.Helpers
{
/// <summary>Users table representation.</summary>
[Table(Name = "sample_users", Override = true)]
public class Users
{
/// <summary>Gets or sets id column value.</summary>
[Column("id", true)]
public long Id { get; set; }
/// <summary>Gets or sets code column value.</summary>
[Column("code")]
public string Code { get; set; }
/// <summary>Gets or sets login column value.</summary>
[Column("login")]
public string Login { get; set; }
/// <summary>Gets or sets first column value.</summary>
[Column("first")]
public string First { get; set; }
/// <summary>Gets or sets last column value.</summary>
[Column("last")]
public string Last { get; set; }
/// <summary>Gets or sets password column value.</summary>
[Column("password")]
public string Password { get; set; }
/// <summary>Gets or sets email column value.</summary>
[Column("email")]
public string Email { get; set; }
/// <summary>Gets or sets quote column value.</summary>
[Column("quote")]
public string Quote { get; set; }
/// <summary>Gets or sets value of aggregate fields.</summary>
[Ignore]
public object AggregateField { get; set; }
}
}

View File

@@ -1,67 +1,67 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Diagnostics.CodeAnalysis;
using DynamORM.Mapper;
namespace DynamORM.Tests.Helpers
{
/// <summary>Users table representation.</summary>
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Bare bone table mapping.")]
public class users
{
/// <summary>Gets or sets id column value.</summary>
[Column("id", true)]
public long id { get; set; }
/// <summary>Gets or sets code column value.</summary>
public string code { get; set; }
/// <summary>Gets or sets login column value.</summary>
public string login { get; set; }
/// <summary>Gets or sets first column value.</summary>
public string first { get; set; }
/// <summary>Gets or sets last column value.</summary>
public string last { get; set; }
/// <summary>Gets or sets password column value.</summary>
public string password { get; set; }
/// <summary>Gets or sets email column value.</summary>
public string email { get; set; }
/// <summary>Gets or sets quote column value.</summary>
public string quote { get; set; }
/// <summary>Gets or sets value of aggregate fields.</summary>
[Ignore]
public object aggregatefield { get; set; }
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Diagnostics.CodeAnalysis;
using DynamORM.Mapper;
namespace DynamORM.Tests.Helpers
{
/// <summary>Users table representation.</summary>
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Bare bone table mapping.")]
public class sample_users
{
/// <summary>Gets or sets id column value.</summary>
[Column("id", true)]
public long id { get; set; }
/// <summary>Gets or sets code column value.</summary>
public string code { get; set; }
/// <summary>Gets or sets login column value.</summary>
public string login { get; set; }
/// <summary>Gets or sets first column value.</summary>
public string first { get; set; }
/// <summary>Gets or sets last column value.</summary>
public string last { get; set; }
/// <summary>Gets or sets password column value.</summary>
public string password { get; set; }
/// <summary>Gets or sets email column value.</summary>
public string email { get; set; }
/// <summary>Gets or sets quote column value.</summary>
public string quote { get; set; }
/// <summary>Gets or sets value of aggregate fields.</summary>
[Ignore]
public object aggregatefield { get; set; }
}
}

View File

@@ -1,80 +1,80 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using DynamORM.Mapper;
using DynamORM.Validation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Helpers.Validation
{
[TestClass]
public class ObjectValidationTest
{
public class TestObject
{
[Required(1f, 10f)]
public int TestInt { get; set; }
[Required(7, false, false)]
public string CanBeNull { get; set; }
[Required(2, true)]
[Required(7, 18, ElementRequirement = true)]
public decimal[] ArrayTest { get; set; }
}
[TestMethod]
public void ValidateCorrectObject()
{
var result = DynamicMapperCache.GetMapper<TestObject>().ValidateObject(
new TestObject
{
TestInt = 2,
ArrayTest = new decimal[] { 7, 18 },
});
Assert.IsNotNull(result);
Assert.AreEqual(0, result.Count);
}
[TestMethod]
public void ValidateIncorrectObject()
{
var result = DynamicMapperCache.GetMapper<TestObject>().ValidateObject(
new TestObject
{
TestInt = 0,
CanBeNull = string.Empty,
ArrayTest = new decimal[] { 0, 0 },
});
Assert.IsNotNull(result);
Assert.AreEqual(4, result.Count);
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using DynamORM.Mapper;
using DynamORM.Validation;
using NUnit.Framework;
namespace DynamORM.Tests.Helpers.Validation
{
[TestFixture]
public class ObjectValidationTest
{
public class TestObject
{
[Required(1f, 10f)]
public int TestInt { get; set; }
[Required(7, false, false)]
public string CanBeNull { get; set; }
[Required(2, true)]
[Required(7, 18, ElementRequirement = true)]
public decimal[] ArrayTest { get; set; }
}
[Test]
public void ValidateCorrectObject()
{
var result = DynamicMapperCache.GetMapper<TestObject>().ValidateObject(
new TestObject
{
TestInt = 2,
ArrayTest = new decimal[] { 7, 18 },
});
Assert.IsNotNull(result);
Assert.AreEqual(0, result.Count);
}
[Test]
public void ValidateIncorrectObject()
{
var result = DynamicMapperCache.GetMapper<TestObject>().ValidateObject(
new TestObject
{
TestInt = 0,
CanBeNull = string.Empty,
ArrayTest = new decimal[] { 0, 0 },
});
Assert.IsNotNull(result);
Assert.AreEqual(4, result.Count);
}
}
}

View File

@@ -1,391 +1,391 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System;
using DynamORM.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Modify
{
/// <summary>Test standard dynamic access ORM.</summary>
[TestClass]
public class DynamicModificationTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[TestInitialize]
public virtual void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase();
}
/// <summary>Tear down test objects.</summary>
[TestCleanup]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public virtual dynamic GetTestTable()
{
return Database.Table("users");
}
#region Insert
/// <summary>Test row insertion by dynamic arguments.</summary>
[TestMethod]
public void TestInsertByArguments()
{
Assert.AreEqual(1, GetTestTable().Insert(code: "201", first: null, last: "Gagarin", email: "juri.gagarin@megacorp.com", quote: "bla, bla, bla"));
// Verify
var o = GetTestTable().Single(code: "201");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("201", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row insertion by dynamic object.</summary>
[TestMethod]
public void TestInsertByDynamicObjects()
{
Assert.AreEqual(1, GetTestTable().Insert(values: new { code = "202", first = DBNull.Value, last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }));
// Verify
var o = GetTestTable().Single(code: "202");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("202", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row insertion by mapped object.</summary>
[TestMethod]
public void TestInsertByMappedObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Insert(values: new Users
{
Id = u.Max(columns: "id") + 1,
Code = "203",
First = null,
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "203");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("203", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row insertion by basic object.</summary>
[TestMethod]
public void TestInsertByBasicObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Insert(values: new users
{
id = u.Max(columns: "id") + 1,
code = "204",
first = null,
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "204");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("204", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
#endregion Insert
#region Update
/// <summary>Test row updating by dynamic arguments.</summary>
[TestMethod]
public void TestUpdateByArguments()
{
Assert.AreEqual(1, GetTestTable().Update(id: 1, code: "201", first: null, last: "Gagarin", email: "juri.gagarin@megacorp.com", quote: "bla, bla, bla"));
// Verify
var o = GetTestTable().Single(code: "201");
Assert.AreEqual(1, o.id);
Assert.AreEqual("201", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by dynamic objects.</summary>
[TestMethod]
public void TestUpdateByDynamicObject()
{
Assert.AreEqual(1, GetTestTable().Update(update: new { id = 2, code = "202", first = DBNull.Value, last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }));
// Verify
var o = GetTestTable().Single(code: "202");
Assert.AreEqual(2, o.id);
Assert.AreEqual("202", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by mapped object.</summary>
[TestMethod]
public void TestUpdateByMappedObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(update: new Users
{
Id = 3,
Code = "203",
First = null,
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "203");
Assert.AreEqual(3, o.id);
Assert.AreEqual("203", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by basic object.</summary>
[TestMethod]
public void TestUpdateByBasicObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(update: new users
{
id = 4,
code = "204",
first = null,
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "204");
Assert.AreEqual(4, o.id);
Assert.AreEqual("204", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by dynamic objects.</summary>
[TestMethod]
public void TestUpdateByDynamicObjects()
{
Assert.AreEqual(1, GetTestTable().Update(values: new { code = "205", first = DBNull.Value, last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }, where: new { id = 5 }));
// Verify
var o = GetTestTable().Single(code: "205");
Assert.AreEqual(5, o.id);
Assert.AreEqual("205", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by mapped objects.</summary>
[TestMethod]
public void TestUpdateByMappedObjects()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(values: new Users
{
Id = 6,
Code = "206",
First = null,
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}, id: 6));
// Verify
var o = u.Single(code: "206");
Assert.AreEqual(6, o.id);
Assert.AreEqual("206", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by basic objects.</summary>
[TestMethod]
public void TestUpdateByBasicObjects()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(values: new users
{
id = 7,
code = "207",
first = null,
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}, id: 7));
// Verify
var o = u.Single(code: "207");
Assert.AreEqual(7, o.id);
Assert.AreEqual("207", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
#endregion Update
#region Delete
/// <summary>Test row deleting by dynamic arguments.</summary>
[TestMethod]
public void TestDeleteByArguments()
{
Assert.AreEqual(1, GetTestTable().Delete(code: "10"));
// Verify
Assert.AreEqual(0, GetTestTable().Count(code: "10"));
}
/// <summary>Test row deleting by dynamic objects (all except ID should be ignored).</summary>
[TestMethod]
public void TestDeleteyDynamicObject()
{
Assert.AreEqual(1, GetTestTable().Delete(delete: new { id = 11, code = 11, first = "Juri", last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 11));
}
/// <summary>Test row deleting by mapped object.</summary>
[TestMethod]
public void TestDeleteByMappedObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Delete(delete: new Users
{
Id = 12,
Code = "12",
First = "Juri",
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 12));
}
/// <summary>Test row deleting by basic object.</summary>
[TestMethod]
public void TestDeleteByBasicObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Delete(delete: new users
{
id = 13,
code = "13",
first = "Juri",
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 13));
}
/// <summary>Test row deleting by dynamic objects (all except ID should be ignored).</summary>
[TestMethod]
public void TestDeleteyDynamicObjectWhere()
{
Assert.AreEqual(1, GetTestTable().Delete(where: new { id = 14, code = "14" }));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 14));
}
#endregion Delete
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System;
using DynamORM.Tests.Helpers;
using NUnit.Framework;
namespace DynamORM.Tests.Modify
{
/// <summary>Test standard dynamic access ORM.</summary>
[TestFixture]
public class DynamicModificationTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[SetUp]
public virtual void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase();
}
/// <summary>Tear down test objects.</summary>
[TearDown]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public virtual dynamic GetTestTable()
{
return Database.Table("sample_users");
}
#region Insert
/// <summary>Test row insertion by dynamic arguments.</summary>
[Test]
public void TestInsertByArguments()
{
Assert.AreEqual(1, GetTestTable().Insert(code: "201", first: null, last: "Gagarin", email: "juri.gagarin@megacorp.com", quote: "bla, bla, bla"));
// Verify
var o = GetTestTable().Single(code: "201");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("201", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row insertion by dynamic object.</summary>
[Test]
public void TestInsertByDynamicObjects()
{
Assert.AreEqual(1, GetTestTable().Insert(values: new { code = "202", first = DBNull.Value, last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }));
// Verify
var o = GetTestTable().Single(code: "202");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("202", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row insertion by mapped object.</summary>
[Test]
public void TestInsertByMappedObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Insert(values: new Users
{
Id = u.Max(columns: "id") + 1,
Code = "203",
First = null,
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "203");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("203", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row insertion by basic object.</summary>
[Test]
public void TestInsertByBasicObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Insert(values: new sample_users
{
id = u.Max(columns: "id") + 1,
code = "204",
first = null,
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "204");
Assert.AreNotEqual(200, o.id);
Assert.AreEqual("204", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
#endregion Insert
#region Update
/// <summary>Test row updating by dynamic arguments.</summary>
[Test]
public void TestUpdateByArguments()
{
Assert.AreEqual(1, GetTestTable().Update(id: 1, code: "201", first: null, last: "Gagarin", email: "juri.gagarin@megacorp.com", quote: "bla, bla, bla"));
// Verify
var o = GetTestTable().Single(code: "201");
Assert.AreEqual(1, o.id);
Assert.AreEqual("201", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by dynamic objects.</summary>
[Test]
public void TestUpdateByDynamicObject()
{
Assert.AreEqual(1, GetTestTable().Update(update: new { id = 2, code = "202", first = DBNull.Value, last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }));
// Verify
var o = GetTestTable().Single(code: "202");
Assert.AreEqual(2, o.id);
Assert.AreEqual("202", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by mapped object.</summary>
[Test]
public void TestUpdateByMappedObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(update: new Users
{
Id = 3,
Code = "203",
First = null,
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "203");
Assert.AreEqual(3, o.id);
Assert.AreEqual("203", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by basic object.</summary>
[Test]
public void TestUpdateByBasicObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(update: new sample_users
{
id = 4,
code = "204",
first = null,
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}));
// Verify
var o = u.Single(code: "204");
Assert.AreEqual(4, o.id);
Assert.AreEqual("204", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by dynamic objects.</summary>
[Test]
public void TestUpdateByDynamicObjects()
{
Assert.AreEqual(1, GetTestTable().Update(values: new { code = "205", first = DBNull.Value, last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }, where: new { id = 5 }));
// Verify
var o = GetTestTable().Single(code: "205");
Assert.AreEqual(5, o.id);
Assert.AreEqual("205", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by mapped objects.</summary>
[Test]
public void TestUpdateByMappedObjects()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(values: new Users
{
Id = 6,
Code = "206",
First = null,
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}, id: 6));
// Verify
var o = u.Single(code: "206");
Assert.AreEqual(6, o.id);
Assert.AreEqual("206", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
/// <summary>Test row updating by basic objects.</summary>
[Test]
public void TestUpdateByBasicObjects()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Update(values: new sample_users
{
id = 7,
code = "207",
first = null,
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}, id: 7));
// Verify
var o = u.Single(code: "207");
Assert.AreEqual(7, o.id);
Assert.AreEqual("207", o.code.ToString());
Assert.IsNull(o.first);
Assert.AreEqual("Gagarin", o.last);
Assert.AreEqual("juri.gagarin@megacorp.com", o.email);
Assert.AreEqual("bla, bla, bla", o.quote);
Assert.IsNull(o.password);
}
#endregion Update
#region Delete
/// <summary>Test row deleting by dynamic arguments.</summary>
[Test]
public void TestDeleteByArguments()
{
Assert.AreEqual(1, GetTestTable().Delete(code: "10"));
// Verify
Assert.AreEqual(0, GetTestTable().Count(code: "10"));
}
/// <summary>Test row deleting by dynamic objects (all except ID should be ignored).</summary>
[Test]
public void TestDeleteyDynamicObject()
{
Assert.AreEqual(1, GetTestTable().Delete(delete: new { id = 11, code = 11, first = "Juri", last = "Gagarin", email = "juri.gagarin@megacorp.com", quote = "bla, bla, bla" }));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 11));
}
/// <summary>Test row deleting by mapped object.</summary>
[Test]
public void TestDeleteByMappedObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Delete(delete: new Users
{
Id = 12,
Code = "12",
First = "Juri",
Last = "Gagarin",
Email = "juri.gagarin@megacorp.com",
Quote = "bla, bla, bla"
}));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 12));
}
/// <summary>Test row deleting by basic object.</summary>
[Test]
public void TestDeleteByBasicObject()
{
var u = GetTestTable();
Assert.AreEqual(1, u.Delete(delete: new sample_users
{
id = 13,
code = "13",
first = "Juri",
last = "Gagarin",
email = "juri.gagarin@megacorp.com",
quote = "bla, bla, bla"
}));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 13));
}
/// <summary>Test row deleting by dynamic objects (all except ID should be ignored).</summary>
[Test]
public void TestDeleteyDynamicObjectWhere()
{
Assert.AreEqual(1, GetTestTable().Delete(where: new { id = 14, code = "14" }));
// Verify
Assert.AreEqual(0, GetTestTable().Count(id: 14));
}
#endregion Delete
}
}

View File

@@ -1,55 +1,55 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Modify
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestClass]
public class DynamicNoSchemaModificationTests : DynamicModificationTests
{
/// <summary>Setup test parameters.</summary>
[TestInitialize]
public virtual void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table("users", new string[] { "id" });
}
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using NUnit.Framework;
namespace DynamORM.Tests.Modify
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestFixture]
public class DynamicNoSchemaModificationTests : DynamicModificationTests
{
/// <summary>Setup test parameters.</summary>
[SetUp]
public override void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table("sample_users", new string[] { "id" });
}
}
}

View File

@@ -1,69 +1,69 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Collections.Generic;
using DynamORM.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Modify
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestClass]
public class DynamicTypeSchemaModificationTests : DynamicModificationTests
{
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table<users>();
}
/// <summary>
/// Tests the bulk insert.
/// </summary>
[TestMethod]
public void TestBulkInsert()
{
Assert.AreEqual(2, Database.Insert<users>(new List<users>
{
new users
{
id = 1001,
login = "a",
},
new users
{
id = 1002,
login = "b",
}
}));
Assert.AreEqual(2, Database.Delete<users>().Where(u => u.users.id.In(1001, 1002)).Execute());
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Collections.Generic;
using DynamORM.Tests.Helpers;
using NUnit.Framework;
namespace DynamORM.Tests.Modify
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestFixture]
public class DynamicTypeSchemaModificationTests : DynamicModificationTests
{
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table<sample_users>();
}
/// <summary>
/// Tests the bulk insert.
/// </summary>
[Test]
public void TestBulkInsert()
{
Assert.AreEqual(2, Database.Insert<sample_users>(new List<sample_users>
{
new sample_users
{
id = 1001,
login = "a",
},
new sample_users
{
id = 1002,
login = "b",
}
}));
Assert.AreEqual(2, Database.Delete<sample_users>().Where(u => u.sample_users.id.In(1001, 1002)).Execute());
}
}
}

View File

@@ -1,225 +1,225 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Linq;
using DynamORM.Builders;
using DynamORM.Builders.Implementation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DynamORM.Tests.Helpers;
using System.Collections.Generic;
using static System.Data.Entity.Infrastructure.Design.Executor;
using System.Runtime.InteropServices;
namespace DynamORM.Tests.Modify
{
/// <summary>New parser tests.</summary>
[TestClass]
public class ParserTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[TestInitialize]
public virtual void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Tear down test objects.</summary>
[TestCleanup]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
#region Insert
/// <summary>
/// Tests the basic insert.
/// </summary>
[TestMethod]
public void TestInsertBasic()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => x.Users.Code = "001", x => x.Users.Name = "Admin", x => x.Users.IsAdmin = 1);
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0})",
string.Join(", ", cmd.Parameters.Keys.Select(p => string.Format("[${0}]", p)))), cmd.CommandText());
}
/// <summary>
/// Tests the insert with sub query.
/// </summary>
[TestMethod]
public void TestInsertSubQuery()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => x.Code = "001", x => x.Name = "Admin", x => x.IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == "001")));
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0}, (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = [${1}])))",
string.Join(", ", cmd.Parameters.Keys.Take(2).Select(p => string.Format("[${0}]", p))), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the basic insert using object.
/// </summary>
[TestMethod]
public void TestInsertBasicObject()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => new { Code = "001", Name = "Admin", IsAdmin = 1 });
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0})",
string.Join(", ", cmd.Parameters.Keys.Select(p => string.Format("[${0}]", p)))), cmd.CommandText());
}
/// <summary>
/// Tests the insert using object with sub query.
/// </summary>
[TestMethod]
public void TestInsertSubQueryObject()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => new
{
Code = "001",
Name = "Admin",
IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == "001"))
});
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0}, (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = [${1}])))",
string.Join(", ", cmd.Parameters.Keys.Take(2).Select(p => string.Format("[${0}]", p))), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
#endregion Insert
#region Update
/// <summary>
/// Tests the basic update.
/// </summary>
[TestMethod]
public void TestUpdateBasicSet()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => x.Users.Code = "001", x => x.Users.Name = "Admin", x => x.Users.IsAdmin = 1)
.Where(x => x.Users.Id_User == 1);
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = [${2}] WHERE (""Users"".""Id_User"" = [${3}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2], cmd.Parameters.Keys.ToArray()[3]), cmd.CommandText());
}
/// <summary>
/// Tests the basic update.
/// </summary>
[TestMethod]
public void TestUpdateBasicValues()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd
.Values("Code", "001")
.Values("Name", "Admin")
.Values("IsAdmin", "1")
.Where(x => x.Users.Id_User == 1);
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = [${2}] WHERE (""Users"".""Id_User"" = [${3}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2], cmd.Parameters.Keys.ToArray()[3]), cmd.CommandText());
}
/// <summary>
/// Tests the insert with sub query.
/// </summary>
[TestMethod]
public void TestUpdateSubQuery()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => x.Users.Code = "001", x => x.Users.Name = "Admin", x => x.Users.IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == a.Users.Id_User)))
.Where(x => x.Users.Id_User == 1);
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = ""Users"".""Id_User"")) WHERE (""Users"".""Id_User"" = [${2}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2]), cmd.CommandText());
}
/// <summary>
/// Tests the basic insert using object.
/// </summary>
[TestMethod]
public void TestUpdateBasicObject()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => new { Code = "001", Name = "Admin", IsAdmin = 1 })
.Where(x => new { Id_User = 1 });
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = [${2}] WHERE (""Id_User"" = [${3}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2], cmd.Parameters.Keys.ToArray()[3]), cmd.CommandText());
}
/// <summary>
/// Tests the basic insert using object.
/// </summary>
[TestMethod]
public void TestUpdateSubQueryObject()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => new
{
Code = "001",
Name = "Admin",
IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == a.Users.Id_User))
}).Where(x => new { Id_User = 1 });
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = ""Users"".""Id_User"")) WHERE (""Id_User"" = [${2}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2]), cmd.CommandText());
}
#endregion Update
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Linq;
using DynamORM.Builders;
using DynamORM.Builders.Implementation;
using NUnit.Framework;
using DynamORM.Tests.Helpers;
using System.Collections.Generic;
using static System.Data.Entity.Infrastructure.Design.Executor;
using System.Runtime.InteropServices;
namespace DynamORM.Tests.Modify
{
/// <summary>New parser tests.</summary>
[TestFixture]
public class ParserTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[SetUp]
public virtual void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Tear down test objects.</summary>
[TearDown]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
#region Insert
/// <summary>
/// Tests the basic insert.
/// </summary>
[Test]
public void TestInsertBasic()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => x.Users.Code = "001", x => x.Users.Name = "Admin", x => x.Users.IsAdmin = 1);
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0})",
string.Join(", ", cmd.Parameters.Keys.Select(p => string.Format("[${0}]", p)))), cmd.CommandText());
}
/// <summary>
/// Tests the insert with sub query.
/// </summary>
[Test]
public void TestInsertSubQuery()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => x.Code = "001", x => x.Name = "Admin", x => x.IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == "001")));
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0}, (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = [${1}])))",
string.Join(", ", cmd.Parameters.Keys.Take(2).Select(p => string.Format("[${0}]", p))), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the basic insert using object.
/// </summary>
[Test]
public void TestInsertBasicObject()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => new { Code = "001", Name = "Admin", IsAdmin = 1 });
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0})",
string.Join(", ", cmd.Parameters.Keys.Select(p => string.Format("[${0}]", p)))), cmd.CommandText());
}
/// <summary>
/// Tests the insert using object with sub query.
/// </summary>
[Test]
public void TestInsertSubQueryObject()
{
IDynamicInsertQueryBuilder cmd = new DynamicInsertQueryBuilder(Database, "Users");
cmd.Values(x => new
{
Code = "001",
Name = "Admin",
IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == "001"))
});
Assert.AreEqual(string.Format(@"INSERT INTO ""Users"" (""Code"", ""Name"", ""IsAdmin"") VALUES ({0}, (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = [${1}])))",
string.Join(", ", cmd.Parameters.Keys.Take(2).Select(p => string.Format("[${0}]", p))), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
#endregion Insert
#region Update
/// <summary>
/// Tests the basic update.
/// </summary>
[Test]
public void TestUpdateBasicSet()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => x.Users.Code = "001", x => x.Users.Name = "Admin", x => x.Users.IsAdmin = 1)
.Where(x => x.Users.Id_User == 1);
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = [${2}] WHERE (""Users"".""Id_User"" = [${3}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2], cmd.Parameters.Keys.ToArray()[3]), cmd.CommandText());
}
/// <summary>
/// Tests the basic update.
/// </summary>
[Test]
public void TestUpdateBasicValues()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd
.Values("Code", "001")
.Values("Name", "Admin")
.Values("IsAdmin", "1")
.Where(x => x.Users.Id_User == 1);
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = [${2}] WHERE (""Users"".""Id_User"" = [${3}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2], cmd.Parameters.Keys.ToArray()[3]), cmd.CommandText());
}
/// <summary>
/// Tests the insert with sub query.
/// </summary>
[Test]
public void TestUpdateSubQuery()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => x.Users.Code = "001", x => x.Users.Name = "Admin", x => x.Users.IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == a.Users.Id_User)))
.Where(x => x.Users.Id_User == 1);
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = ""Users"".""Id_User"")) WHERE (""Users"".""Id_User"" = [${2}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2]), cmd.CommandText());
}
/// <summary>
/// Tests the basic insert using object.
/// </summary>
[Test]
public void TestUpdateBasicObject()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => new { Code = "001", Name = "Admin", IsAdmin = 1 })
.Where(x => new { Id_User = 1 });
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = [${2}] WHERE (""Id_User"" = [${3}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2], cmd.Parameters.Keys.ToArray()[3]), cmd.CommandText());
}
/// <summary>
/// Tests the basic insert using object.
/// </summary>
[Test]
public void TestUpdateSubQueryObject()
{
IDynamicUpdateQueryBuilder cmd = new DynamicUpdateQueryBuilder(Database, "Users");
cmd.Set(x => new
{
Code = "001",
Name = "Admin",
IsAdmin = x(cmd
.SubQuery(a => a.AccessRights.As(a.a))
.Select(a => a.IsAdmin)
.Where(a => a.User_Id == a.Users.Id_User))
}).Where(x => new { Id_User = 1 });
Assert.AreEqual(string.Format(@"UPDATE ""Users"" SET ""Code"" = [${0}], ""Name"" = [${1}], ""IsAdmin"" = (SELECT a.""IsAdmin"" FROM ""AccessRights"" AS a WHERE (a.""User_Id"" = ""Users"".""Id_User"")) WHERE (""Id_User"" = [${2}])",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2]), cmd.CommandText());
}
#endregion Update
}
}

View File

@@ -1,75 +1,75 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DynamORM.Tests.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DynamORM.Tests.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to CREATE TABLE users (id INTEGER NOT NULL PRIMARY KEY, code, login text, first text, last text, password text, email text, quote text);
///INSERT INTO users (code,first,last,email,quote) VALUES (&apos;1&apos;,&apos;Clarke&apos;,&apos;Jarvis&apos;,&apos;eu.accumsan@nonarcuVivamus.org&apos;,&apos;non leo. Vivamus&apos;);
///INSERT INTO users (code,first,last,email,quote) VALUES (&apos;2&apos;,&apos;Marny&apos;,&apos;Fry&apos;,&apos;Cras.convallis.convallis@nisiCumsociis.ca&apos;,&apos;aliquam eu, accumsan sed, facilisis vitae, orci. Phasellus&apos;);
///INSERT INTO users (code,first,last,email,quote) VALUES (&apos;3&apos;,&apos; [rest of string was truncated]&quot;;.
/// </summary>
internal static string UsersTable {
get {
return ResourceManager.GetString("UsersTable", resourceCulture);
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DynamORM.Tests.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DynamORM.Tests.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to CREATE TABLE sample_users (id INTEGER NOT NULL PRIMARY KEY, code, login text, first text, last text, password text, email text, quote text);
///INSERT INTO sample_users (code,first,last,email,quote) VALUES (&apos;1&apos;,&apos;Clarke&apos;,&apos;Jarvis&apos;,&apos;eu.accumsan@nonarcuVivamus.org&apos;,&apos;non leo. Vivamus&apos;);
///INSERT INTO sample_users (code,first,last,email,quote) VALUES (&apos;2&apos;,&apos;Marny&apos;,&apos;Fry&apos;,&apos;Cras.convallis.convallis@nisiCumsociis.ca&apos;,&apos;aliquam eu, accumsan sed, facilisis vitae, orci. Phasellus&apos;);
///INSERT INTO sample_users (code,first,last,email,quote) VALUES (&apos;3&apos;,&apos; [rest of string was truncated]&quot;;.
/// </summary>
internal static string UsersTable {
get {
return ResourceManager.GetString("UsersTable", resourceCulture);
}
}
}
}

View File

@@ -1,324 +1,324 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="UsersTable" xml:space="preserve">
<value>CREATE TABLE users (id INTEGER NOT NULL PRIMARY KEY, code, login text, first text, last text, password text, email text, quote text);
INSERT INTO users (code,first,last,email,quote) VALUES ('1','Clarke','Jarvis','eu.accumsan@nonarcuVivamus.org','non leo. Vivamus');
INSERT INTO users (code,first,last,email,quote) VALUES ('2','Marny','Fry','Cras.convallis.convallis@nisiCumsociis.ca','aliquam eu, accumsan sed, facilisis vitae, orci. Phasellus');
INSERT INTO users (code,first,last,email,quote) VALUES ('3','Dai','Marks','dictum.augue@venenatis.ca','nulla ante, iaculis nec, eleifend non, dapibus rutrum, justo. Praesent');
INSERT INTO users (code,first,last,email,quote) VALUES ('4','Forrest','Hendricks','justo.sit.amet@odioa.edu','auctor. Mauris vel turpis. Aliquam adipiscing lobortis');
INSERT INTO users (code,first,last,email,quote) VALUES ('5','Blossom','Dunlap','libero.mauris@Phasellusfermentumconvallis.ca','luctus sit amet, faucibus ut, nulla. Cras eu tellus eu');
INSERT INTO users (code,first,last,email,quote) VALUES ('6','George','Rios','vitae@sodales.ca','elit. Aliquam auctor, velit eget laoreet');
INSERT INTO users (code,first,last,email,quote) VALUES ('7','Ivory','Henderson','elit.Aliquam.auctor@Nullamvelitdui.ca','Fusce diam nunc, ullamcorper');
INSERT INTO users (code,first,last,email,quote) VALUES ('8','Inez','Goodwin','consectetuer.mauris@nibhPhasellus.edu','eu, placerat eget, venenatis a, magna.');
INSERT INTO users (code,first,last,email,quote) VALUES ('9','Sigourney','Gonzales','lectus.pede.ultrices@sagittislobortismauris.org','egestas hendrerit');
INSERT INTO users (code,first,last,email,quote) VALUES ('10','Fulton','Terrell','penatibus@euaugue.com','Nulla interdum. Curabitur dictum.');
INSERT INTO users (code,first,last,email,quote) VALUES ('11','Logan','Freeman','malesuada.malesuada@nullaIntegervulputate.edu','dui, semper et, lacinia');
INSERT INTO users (code,first,last,email,quote) VALUES ('12','Anne','Irwin','lorem.ut.aliquam@ligula.org','erat, in consectetuer ipsum nunc id enim.');
INSERT INTO users (code,first,last,email,quote) VALUES ('13','Alexandra','Church','sit@sempererat.org','lorem, luctus ut, pellentesque eget, dictum placerat, augue. Sed');
INSERT INTO users (code,first,last,email,quote) VALUES ('14','Adena','Branch','sit.amet@accumsanlaoreetipsum.org','natoque penatibus et');
INSERT INTO users (code,first,last,email,quote) VALUES ('15','Lionel','Hoover','ac@Donectempor.ca','at pede. Cras vulputate');
INSERT INTO users (code,first,last,email,quote) VALUES ('16','Aimee','Strickland','ornare.lectus@tinciduntduiaugue.ca','vitae odio sagittis semper. Nam');
INSERT INTO users (code,first,last,email,quote) VALUES ('17','Selma','Williamson','metus.In.nec@quamquisdiam.org','id nunc');
INSERT INTO users (code,first,last,email,quote) VALUES ('18','Lara','Trujillo','lacus@convallisest.edu','Integer sem elit, pharetra ut,');
INSERT INTO users (code,first,last,email,quote) VALUES ('19','Ori','Ellis','egestas@at.ca','odio. Nam interdum');
INSERT INTO users (code,first,last,email,quote) VALUES ('20','Macey','Carey','sed.consequat@ametorciUt.org','magna');
INSERT INTO users (code,first,last,email,quote) VALUES ('21','Quynn','Randall','Cras.dictum@malesuada.org','egestas. Fusce aliquet magna a neque.');
INSERT INTO users (code,first,last,email,quote) VALUES ('22','Alec','Robles','Fusce.feugiat@mollisdui.com','a');
INSERT INTO users (code,first,last,email,quote) VALUES ('23','Jakeem','Bell','ante@laoreetlectusquis.edu','eget massa. Suspendisse eleifend. Cras');
INSERT INTO users (code,first,last,email,quote) VALUES ('24','Katelyn','Cannon','sit.amet@PhasellusornareFusce.org','nisi dictum augue malesuada malesuada.');
INSERT INTO users (code,first,last,email,quote) VALUES ('25','Christian','Alford','per@vulputate.ca','turpis.');
INSERT INTO users (code,first,last,email,quote) VALUES ('26','Leila','Forbes','nec.ante@idblanditat.ca','ac ipsum. Phasellus');
INSERT INTO users (code,first,last,email,quote) VALUES ('27','Hadley','Gillespie','Lorem.ipsum@Nullamvitaediam.com','vestibulum lorem, sit amet ultricies sem magna nec quam.');
INSERT INTO users (code,first,last,email,quote) VALUES ('28','Julian','Keith','facilisis@loremvitaeodio.edu','nulla at sem molestie sodales. Mauris blandit enim consequat purus.');
INSERT INTO users (code,first,last,email,quote) VALUES ('29','Allen','Ramos','neque@lobortis.ca','amet diam eu dolor egestas rhoncus. Proin nisl sem, consequat');
INSERT INTO users (code,first,last,email,quote) VALUES ('30','Hermione','Walsh','dictum.magna@tincidunt.edu','scelerisque');
INSERT INTO users (code,first,last,email,quote) VALUES ('31','Xena','Graves','eu.dui@tinciduntaliquamarcu.ca','nunc interdum feugiat. Sed nec metus facilisis lorem tristique aliquet.');
INSERT INTO users (code,first,last,email,quote) VALUES ('32','Tanisha','Blackburn','aliquam.eu.accumsan@dui.edu','fringilla mi lacinia mattis. Integer eu');
INSERT INTO users (code,first,last,email,quote) VALUES ('33','Norman','Hobbs','eu.euismod.ac@tinciduntDonecvitae.com','pulvinar arcu et pede. Nunc');
INSERT INTO users (code,first,last,email,quote) VALUES ('34','Guy','Molina','non@rutrumurna.org','Vivamus euismod urna.');
INSERT INTO users (code,first,last,email,quote) VALUES ('35','Rama','Albert','nunc@laciniavitaesodales.com','eu augue porttitor interdum. Sed auctor odio a purus. Duis');
INSERT INTO users (code,first,last,email,quote) VALUES ('36','Owen','Combs','Nullam.enim.Sed@magnaPhasellusdolor.com','mollis vitae, posuere at, velit. Cras lorem lorem, luctus');
INSERT INTO users (code,first,last,email,quote) VALUES ('37','Ashely','Graham','eget.odio@enimsitamet.com','commodo at, libero. Morbi accumsan laoreet ipsum. Curabitur consequat,');
INSERT INTO users (code,first,last,email,quote) VALUES ('38','Paul','Levy','nec@leo.com','augue scelerisque mollis. Phasellus libero mauris, aliquam eu, accumsan');
INSERT INTO users (code,first,last,email,quote) VALUES ('39','Octavia','Calderon','eu@maurissitamet.edu','est, mollis non, cursus non,');
INSERT INTO users (code,first,last,email,quote) VALUES ('40','Lenore','Pugh','eu.metus.In@Cumsociisnatoque.com','scelerisque mollis. Phasellus libero mauris, aliquam eu, accumsan sed, facilisis');
INSERT INTO users (code,first,last,email,quote) VALUES ('41','Regan','Clemons','eu.neque.pellentesque@Integerinmagna.ca','Curae;');
INSERT INTO users (code,first,last,email,quote) VALUES ('42','Zachary','Haynes','eu.erat@ipsum.edu','quis lectus. Nullam');
INSERT INTO users (code,first,last,email,quote) VALUES ('43','Dane','Hyde','rhoncus@auctor.com','magna et ipsum cursus vestibulum. Mauris magna. Duis dignissim');
INSERT INTO users (code,first,last,email,quote) VALUES ('44','Mara','Hansen','Nunc.commodo@ultricies.org','magna. Ut tincidunt orci quis lectus. Nullam suscipit, est');
INSERT INTO users (code,first,last,email,quote) VALUES ('45','Zelda','Parrish','turpis.In@rutrummagnaCras.com','Suspendisse aliquet, sem ut cursus luctus, ipsum leo');
INSERT INTO users (code,first,last,email,quote) VALUES ('46','Amaya','Richmond','lacinia.at@in.org','ac, fermentum vel, mauris.');
INSERT INTO users (code,first,last,email,quote) VALUES ('47','Hedda','Murray','ac.fermentum.vel@ipsum.com','tincidunt, neque vitae semper egestas, urna justo faucibus lectus, a');
INSERT INTO users (code,first,last,email,quote) VALUES ('48','Brendan','Macdonald','dignissim@leoMorbi.com','vestibulum lorem, sit');
INSERT INTO users (code,first,last,email,quote) VALUES ('49','Gray','Mccall','risus.Donec@atsem.ca','libero est, congue');
INSERT INTO users (code,first,last,email,quote) VALUES ('50','Shoshana','Tran','nunc.In@aliquet.org','magna sed dui.');
INSERT INTO users (code,first,last,email,quote) VALUES ('51','Sylvester','Parks','Mauris.molestie@ipsumdolorsit.org','nec, eleifend non, dapibus rutrum, justo.');
INSERT INTO users (code,first,last,email,quote) VALUES ('52','Kennan','Stokes','nonummy.ut.molestie@varius.org','Ut nec urna et arcu imperdiet ullamcorper. Duis');
INSERT INTO users (code,first,last,email,quote) VALUES ('53','Quin','Park','porttitor@vulputateeu.com','scelerisque, lorem ipsum sodales');
INSERT INTO users (code,first,last,email,quote) VALUES ('54','Madison','Bailey','nec.orci.Donec@vestibulumnequesed.org','augue. Sed');
INSERT INTO users (code,first,last,email,quote) VALUES ('55','Kenyon','Reilly','ultrices.iaculis.odio@sit.ca','enim. Curabitur massa. Vestibulum accumsan neque');
INSERT INTO users (code,first,last,email,quote) VALUES ('56','Drew','Brooks','molestie.orci@aliquetdiamSed.org','at risus. Nunc ac sem ut dolor dapibus gravida.');
INSERT INTO users (code,first,last,email,quote) VALUES ('57','Omar','Dunn','vel@Donecsollicitudinadipiscing.ca','ultrices posuere cubilia Curae; Phasellus ornare. Fusce mollis. Duis sit');
INSERT INTO users (code,first,last,email,quote) VALUES ('58','Glenna','Lambert','Proin.non@Phasellus.com','neque. In');
INSERT INTO users (code,first,last,email,quote) VALUES ('59','Aspen','Bailey','in.dolor.Fusce@ipsum.org','a, arcu. Sed et libero. Proin');
INSERT INTO users (code,first,last,email,quote) VALUES ('60','Adele','Carlson','velit.justo.nec@vehicularisusNulla.edu','risus.');
INSERT INTO users (code,first,last,email,quote) VALUES ('61','Kerry','Zimmerman','luctus.aliquet.odio@urnajusto.edu','purus. Duis elementum, dui quis accumsan convallis, ante lectus convallis');
INSERT INTO users (code,first,last,email,quote) VALUES ('62','Hedda','Guthrie','vulputate.risus@Phaselluselit.ca','ac mattis velit justo nec');
INSERT INTO users (code,first,last,email,quote) VALUES ('63','Wyoming','Blackburn','nec.ante@lorem.org','ultricies');
INSERT INTO users (code,first,last,email,quote) VALUES ('64','Palmer','Dennis','venenatis.lacus@Donecnonjusto.org','a, arcu. Sed et libero. Proin');
INSERT INTO users (code,first,last,email,quote) VALUES ('65','Wesley','Reeves','massa.Suspendisse.eleifend@nec.edu','consequat');
INSERT INTO users (code,first,last,email,quote) VALUES ('66','Mallory','Todd','Duis@Crasloremlorem.edu','nascetur ridiculus mus. Proin vel arcu eu odio');
INSERT INTO users (code,first,last,email,quote) VALUES ('67','Perry','Kirk','tincidunt.adipiscing@mauris.ca','ullamcorper viverra. Maecenas iaculis aliquet diam. Sed diam lorem,');
INSERT INTO users (code,first,last,email,quote) VALUES ('68','Justina','Horne','enim.nec.tempus@magnanec.com','ipsum ac mi eleifend egestas. Sed pharetra, felis eget');
INSERT INTO users (code,first,last,email,quote) VALUES ('69','Noel','Santana','Duis.elementum.dui@Nullamvitae.org','Phasellus');
INSERT INTO users (code,first,last,email,quote) VALUES ('70','Sylvester','Bridges','Sed.neque@ornarelectusante.org','Maecenas libero');
INSERT INTO users (code,first,last,email,quote) VALUES ('71','Cailin','Baldwin','eu@nibhenim.com','consectetuer');
INSERT INTO users (code,first,last,email,quote) VALUES ('72','Beatrice','Henson','risus.Nunc.ac@Etiam.ca','nec, imperdiet nec, leo. Morbi neque');
INSERT INTO users (code,first,last,email,quote) VALUES ('73','Kellie','Curry','quis.turpis.vitae@Quisque.org','ipsum. Suspendisse non leo.');
INSERT INTO users (code,first,last,email,quote) VALUES ('74','Justine','Stewart','Curabitur@dui.org','natoque penatibus et magnis dis parturient');
INSERT INTO users (code,first,last,email,quote) VALUES ('75','Dean','Waters','quis.turpis@morbi.ca','Nulla interdum. Curabitur dictum. Phasellus in felis. Nulla tempor augue');
INSERT INTO users (code,first,last,email,quote) VALUES ('76','Helen','Porter','molestie.dapibus.ligula@ipsum.com','enim non nisi. Aenean eget');
INSERT INTO users (code,first,last,email,quote) VALUES ('77','Janna','Acosta','lectus.a@tempusrisus.com','lectus justo');
INSERT INTO users (code,first,last,email,quote) VALUES ('78','Libby','Vaughn','nisl.sem.consequat@convallis.ca','purus mauris a nunc.');
INSERT INTO users (code,first,last,email,quote) VALUES ('79','Winifred','Cooke','aliquet.sem.ut@etrutrum.ca','metus facilisis lorem tristique aliquet. Phasellus fermentum convallis ligula. Donec');
INSERT INTO users (code,first,last,email,quote) VALUES ('80','Taylor','Glass','sit@maurissitamet.com','orci, consectetuer euismod');
INSERT INTO users (code,first,last,email,quote) VALUES ('81','Melyssa','Palmer','pharetra.sed.hendrerit@fermentum.ca','neque tellus, imperdiet non, vestibulum nec,');
INSERT INTO users (code,first,last,email,quote) VALUES ('82','Kuame','Holman','Vivamus@Donecnibh.edu','cursus non, egestas a, dui. Cras');
INSERT INTO users (code,first,last,email,quote) VALUES ('83','Martin','Hughes','magna@nonbibendum.org','et ultrices posuere cubilia');
INSERT INTO users (code,first,last,email,quote) VALUES ('84','Roanna','Potter','amet.dapibus@aenim.com','est tempor bibendum. Donec');
INSERT INTO users (code,first,last,email,quote) VALUES ('85','Cleo','Carson','Curabitur.dictum.Phasellus@liberoIntegerin.com','mauris');
INSERT INTO users (code,first,last,email,quote) VALUES ('86','Adele','Daugherty','vulputate.ullamcorper@elitfermentumrisus.edu','consequat purus. Maecenas');
INSERT INTO users (code,first,last,email,quote) VALUES ('87','Macon','Todd','et.malesuada@Crasloremlorem.com','montes, nascetur ridiculus');
INSERT INTO users (code,first,last,email,quote) VALUES ('88','Ira','Merritt','risus@eunullaat.ca','metus.');
INSERT INTO users (code,first,last,email,quote) VALUES ('89','Dustin','Landry','nec.orci.Donec@vulputateeu.com','Nunc pulvinar arcu et pede. Nunc sed');
INSERT INTO users (code,first,last,email,quote) VALUES ('90','Debra','Shepherd','dolor.elit@ornareFusce.ca','Suspendisse non leo. Vivamus');
INSERT INTO users (code,first,last,email,quote) VALUES ('91','Channing','Mcknight','tellus@laoreet.ca','non ante bibendum ullamcorper. Duis cursus, diam at pretium aliquet,');
INSERT INTO users (code,first,last,email,quote) VALUES ('92','Abraham','Rodgers','tincidunt.nibh@ipsum.ca','Cum sociis');
INSERT INTO users (code,first,last,email,quote) VALUES ('93','Abel','Mcintyre','et@turpisvitaepurus.com','at pretium aliquet,');
INSERT INTO users (code,first,last,email,quote) VALUES ('94','Lysandra','Cotton','malesuada.malesuada.Integer@gravidamolestie.org','commodo hendrerit. Donec');
INSERT INTO users (code,first,last,email,quote) VALUES ('95','Kane','Bennett','ante.Vivamus@Donec.ca','consectetuer rhoncus. Nullam velit dui, semper et, lacinia vitae, sodales');
INSERT INTO users (code,first,last,email,quote) VALUES ('96','Timothy','Rivas','hendrerit.consectetuer@nonarcuVivamus.ca','Suspendisse non leo. Vivamus nibh dolor, nonummy ac, feugiat');
INSERT INTO users (code,first,last,email,quote) VALUES ('97','Arden','Cote','magnis@sedestNunc.org','purus mauris a nunc.');
INSERT INTO users (code,first,last,email,quote) VALUES ('98','Brynn','Britt','ac@nibhQuisque.edu','Duis gravida. Praesent eu nulla at sem molestie');
INSERT INTO users (code,first,last,email,quote) VALUES ('99','Jerome','Kirkland','ac@nibhPhasellus.com','neque');
INSERT INTO users (code,first,last,email,quote) VALUES ('100','Hoyt','Tran','ullamcorper.viverra@parturientmontesnascetur.org','ac tellus. Suspendisse sed dolor. Fusce mi');
INSERT INTO users (code,first,last,email,quote) VALUES ('101','Abraham','Downs','velit.eu.sem@neceuismod.ca','suscipit,');
INSERT INTO users (code,first,last,email,quote) VALUES ('102','Vivien','Fletcher','Nunc.ut@quamPellentesquehabitant.edu','lobortis. Class aptent taciti sociosqu ad');
INSERT INTO users (code,first,last,email,quote) VALUES ('103','Azalia','Turner','scelerisque@at.edu','odio sagittis semper. Nam tempor diam dictum');
INSERT INTO users (code,first,last,email,quote) VALUES ('104','Tate','Ellis','velit.Sed.malesuada@Cras.com','sed');
INSERT INTO users (code,first,last,email,quote) VALUES ('105','Dennis','Walls','Nullam.scelerisque@amifringilla.edu','arcu. Vestibulum ut eros non enim commodo hendrerit. Donec porttitor');
INSERT INTO users (code,first,last,email,quote) VALUES ('106','Amela','Collins','Quisque@magna.org','Proin');
INSERT INTO users (code,first,last,email,quote) VALUES ('107','Olivia','Dejesus','scelerisque@vitae.org','Duis cursus, diam at pretium aliquet,');
INSERT INTO users (code,first,last,email,quote) VALUES ('108','Mechelle','Russo','Fusce.aliquet.magna@Praesent.org','penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin');
INSERT INTO users (code,first,last,email,quote) VALUES ('109','Hall','Burke','Vivamus.nibh@pellentesque.edu','et libero. Proin mi. Aliquam');
INSERT INTO users (code,first,last,email,quote) VALUES ('110','Chanda','Ayers','magna.Nam.ligula@NullafacilisiSed.org','dui, semper et, lacinia vitae, sodales at,');
INSERT INTO users (code,first,last,email,quote) VALUES ('111','Abdul','Dominguez','pretium.aliquet.metus@vellectusCum.com','vitae erat vel pede blandit congue. In scelerisque scelerisque dui.');
INSERT INTO users (code,first,last,email,quote) VALUES ('112','Wynter','Lynn','tellus.Aenean@ligulatortordictum.ca','adipiscing fringilla, porttitor vulputate, posuere vulputate, lacus. Cras interdum.');
INSERT INTO users (code,first,last,email,quote) VALUES ('113','Molly','Willis','montes.nascetur@sed.org','sem. Nulla interdum. Curabitur dictum. Phasellus in felis.');
INSERT INTO users (code,first,last,email,quote) VALUES ('114','Shafira','Harper','Phasellus.in.felis@ategestas.edu','Vivamus');
INSERT INTO users (code,first,last,email,quote) VALUES ('115','Otto','Gentry','in.molestie.tortor@Fusce.edu','est. Mauris eu turpis. Nulla aliquet. Proin velit.');
INSERT INTO users (code,first,last,email,quote) VALUES ('116','Todd','Riddle','et@nislsem.com','Nulla');
INSERT INTO users (code,first,last,email,quote) VALUES ('117','Mufutau','Pollard','sit@ridiculusmus.org','accumsan neque et nunc. Quisque ornare tortor at');
INSERT INTO users (code,first,last,email,quote) VALUES ('118','Noah','Sears','tristique.neque.venenatis@luctuslobortis.org','dictum');
INSERT INTO users (code,first,last,email,quote) VALUES ('119','Amanda','Clarke','in.consequat@non.org','nisi dictum augue malesuada malesuada. Integer id magna et ipsum');
INSERT INTO users (code,first,last,email,quote) VALUES ('120','Vladimir','Colon','velit.dui@scelerisquenequeNullam.com','pharetra sed, hendrerit a, arcu. Sed et libero.');
INSERT INTO users (code,first,last,email,quote) VALUES ('121','Aaron','Hernandez','Quisque.ornare.tortor@magna.ca','sit amet ante. Vivamus non lorem vitae odio');
INSERT INTO users (code,first,last,email,quote) VALUES ('122','Bert','Gonzales','fermentum@Nullamvelit.ca','quis massa. Mauris vestibulum, neque sed dictum eleifend, nunc');
INSERT INTO users (code,first,last,email,quote) VALUES ('123','Bevis','Leblanc','viverra.Donec@dictumaugue.com','neque sed dictum eleifend, nunc risus varius orci, in');
INSERT INTO users (code,first,last,email,quote) VALUES ('124','Noble','Fisher','Cum@eu.com','Nunc quis arcu');
INSERT INTO users (code,first,last,email,quote) VALUES ('125','Xaviera','Barton','non.arcu@sagittis.com','ultrices posuere cubilia Curae; Phasellus ornare. Fusce mollis. Duis');
INSERT INTO users (code,first,last,email,quote) VALUES ('126','Logan','Roy','Nulla@hendreritconsectetuercursus.com','sed, facilisis vitae, orci. Phasellus dapibus');
INSERT INTO users (code,first,last,email,quote) VALUES ('127','Wilma','Sweet','Nullam.nisl.Maecenas@gravidasagittis.org','ut, nulla. Cras');
INSERT INTO users (code,first,last,email,quote) VALUES ('128','Candace','Olsen','sit.amet@lobortisnisi.com','habitant morbi tristique senectus et netus et malesuada');
INSERT INTO users (code,first,last,email,quote) VALUES ('129','Claire','Alvarado','risus.varius@interdumSed.com','a felis ullamcorper viverra. Maecenas iaculis aliquet');
INSERT INTO users (code,first,last,email,quote) VALUES ('130','Aurelia','Bean','diam.dictum.sapien@eu.edu','libero. Integer in magna. Phasellus');
INSERT INTO users (code,first,last,email,quote) VALUES ('131','Carly','Wilcox','massa.non.ante@Aliquam.com','vehicula risus. Nulla eget metus eu erat semper rutrum. Fusce');
INSERT INTO users (code,first,last,email,quote) VALUES ('132','Xanthus','Graves','vulputate.velit.eu@vitaerisus.com','Cras sed leo. Cras vehicula aliquet libero. Integer in magna.');
INSERT INTO users (code,first,last,email,quote) VALUES ('133','Uta','Justice','adipiscing@consequatdolor.edu','Nam tempor diam dictum sapien. Aenean massa.');
INSERT INTO users (code,first,last,email,quote) VALUES ('134','Alika','Parker','faucibus.ut@Fuscemilorem.edu','vel, venenatis vel, faucibus id,');
INSERT INTO users (code,first,last,email,quote) VALUES ('135','Kasimir','Pugh','sed.turpis@FuscefeugiatLorem.com','justo. Praesent luctus. Curabitur egestas nunc');
INSERT INTO users (code,first,last,email,quote) VALUES ('136','Brock','Acevedo','dapibus.rutrum@convallisconvallisdolor.org','eu enim. Etiam');
INSERT INTO users (code,first,last,email,quote) VALUES ('137','Orla','Hogan','in@Aliquamauctor.com','ac turpis egestas. Aliquam fringilla cursus purus. Nullam scelerisque neque');
INSERT INTO users (code,first,last,email,quote) VALUES ('138','Tatyana','Bean','molestie.arcu@sempercursus.edu','pellentesque, tellus');
INSERT INTO users (code,first,last,email,quote) VALUES ('139','Cadman','Humphrey','auctor@Aeneangravida.edu','eget, dictum');
INSERT INTO users (code,first,last,email,quote) VALUES ('140','Delilah','Quinn','Pellentesque.habitant@liberoMorbi.edu','lobortis quam a felis');
INSERT INTO users (code,first,last,email,quote) VALUES ('141','Briar','Prince','euismod@Aeneangravida.com','at, libero.');
INSERT INTO users (code,first,last,email,quote) VALUES ('142','Hedda','Garrett','eleifend@sitamet.org','ac turpis');
INSERT INTO users (code,first,last,email,quote) VALUES ('143','Sage','Hardy','semper@acfeugiat.org','Nunc laoreet lectus quis massa.');
INSERT INTO users (code,first,last,email,quote) VALUES ('144','Iris','Meyers','Duis.a.mi@Donecnibhenim.edu','vitae aliquam eros turpis non enim. Mauris quis');
INSERT INTO users (code,first,last,email,quote) VALUES ('145','Hayes','Bates','molestie@magnaSuspendisse.com','fringilla. Donec feugiat metus sit amet ante.');
INSERT INTO users (code,first,last,email,quote) VALUES ('146','Rana','Cain','malesuada@loremsitamet.edu','mi');
INSERT INTO users (code,first,last,email,quote) VALUES ('147','acqueline','Mays','est.Nunc.laoreet@est.edu','odio. Phasellus at augue id ante dictum cursus. Nunc');
INSERT INTO users (code,first,last,email,quote) VALUES ('148','Nichole','Suarez','cursus.purus.Nullam@ac.edu','Sed malesuada augue ut lacus. Nulla');
INSERT INTO users (code,first,last,email,quote) VALUES ('149','Sasha','Sparks','fermentum@nonenim.edu','Sed dictum. Proin eget odio.');
INSERT INTO users (code,first,last,email,quote) VALUES ('150','Timon','Lowery','suscipit@Donecat.edu','pede blandit congue. In scelerisque scelerisque dui. Suspendisse ac metus');
INSERT INTO users (code,first,last,email,quote) VALUES ('151','Ivor','Charles','augue.eu@odiovelest.org','quis urna. Nunc quis arcu vel quam dignissim');
INSERT INTO users (code,first,last,email,quote) VALUES ('152','Joelle','Trevino','eget@diamdictumsapien.ca','tortor, dictum eu, placerat eget, venenatis a,');
INSERT INTO users (code,first,last,email,quote) VALUES ('153','Aristotle','Wall','at@Pellentesqueutipsum.com','quis,');
INSERT INTO users (code,first,last,email,quote) VALUES ('154','Amena','Boyd','elit.Etiam@vehiculaet.com','molestie dapibus');
INSERT INTO users (code,first,last,email,quote) VALUES ('155','Rashad','Osborn','ac@aliquam.ca','sed');
INSERT INTO users (code,first,last,email,quote) VALUES ('156','Theodore','Williamson','dignissim.magna@volutpat.ca','Fusce fermentum fermentum');
INSERT INTO users (code,first,last,email,quote) VALUES ('157','Rajah','Logan','enim@Aliquamerat.com','nunc. Quisque ornare tortor');
INSERT INTO users (code,first,last,email,quote) VALUES ('158','Zane','Perez','aliquet@aliquetPhasellus.com','pede.');
INSERT INTO users (code,first,last,email,quote) VALUES ('159','Jena','Rios','urna@velitegetlaoreet.org','eu erat semper rutrum.');
INSERT INTO users (code,first,last,email,quote) VALUES ('160','Amber','Gallagher','conubia@elit.org','Maecenas ornare egestas');
INSERT INTO users (code,first,last,email,quote) VALUES ('161','Veda','Pittman','habitant.morbi.tristique@aliquamenimnec.ca','risus');
INSERT INTO users (code,first,last,email,quote) VALUES ('162','Nathan','Lowe','dui.Cum.sociis@Sed.org','sed, est. Nunc');
INSERT INTO users (code,first,last,email,quote) VALUES ('163','Matthew','Townsend','commodo.auctor.velit@egestasadui.ca','ligula. Aenean euismod');
INSERT INTO users (code,first,last,email,quote) VALUES ('164','Oscar','Richards','vulputate.ullamcorper@eueleifendnec.ca','laoreet ipsum. Curabitur consequat, lectus sit');
INSERT INTO users (code,first,last,email,quote) VALUES ('165','Gareth','Jackson','nec.diam.Duis@nisl.com','iaculis nec, eleifend non, dapibus rutrum, justo. Praesent luctus.');
INSERT INTO users (code,first,last,email,quote) VALUES ('166','Alice','Hyde','Sed.auctor.odio@tortor.edu','id, libero. Donec consectetuer mauris id sapien. Cras dolor');
INSERT INTO users (code,first,last,email,quote) VALUES ('167','Giacomo','Ramos','et.ipsum.cursus@massanon.edu','auctor non, feugiat nec, diam. Duis');
INSERT INTO users (code,first,last,email,quote) VALUES ('168','Ciara','Jacobson','Donec.egestas.Aliquam@Aeneangravidanunc.edu','molestie tellus.');
INSERT INTO users (code,first,last,email,quote) VALUES ('169','Logan','Hendricks','luctus@vulputatedui.ca','in, cursus et, eros. Proin ultrices. Duis volutpat nunc');
INSERT INTO users (code,first,last,email,quote) VALUES ('170','MacKenzie','Campos','luctus.ut.pellentesque@pellentesquea.edu','erat,');
INSERT INTO users (code,first,last,email,quote) VALUES ('171','Nina','Best','purus.sapien@aliquet.ca','dolor sit amet, consectetuer');
INSERT INTO users (code,first,last,email,quote) VALUES ('172','Chester','Howe','Cum.sociis.natoque@Duis.ca','dui, nec tempus');
INSERT INTO users (code,first,last,email,quote) VALUES ('173','Nora','Callahan','in.hendrerit@ametconsectetueradipiscing.com','tempus');
INSERT INTO users (code,first,last,email,quote) VALUES ('174','Molly','Bray','consectetuer@velitSedmalesuada.edu','lorem fringilla ornare placerat, orci lacus vestibulum lorem, sit');
INSERT INTO users (code,first,last,email,quote) VALUES ('175','Ariel','Osborn','et@Aeneanegestashendrerit.ca','enim. Sed nulla ante, iaculis nec,');
INSERT INTO users (code,first,last,email,quote) VALUES ('176','Arsenio','Leblanc','Pellentesque.ut.ipsum@nibh.com','elit pede, malesuada vel, venenatis vel, faucibus id, libero.');
INSERT INTO users (code,first,last,email,quote) VALUES ('177','Deborah','Bowman','enim.Etiam@primisinfaucibus.ca','eu nibh vulputate mauris');
INSERT INTO users (code,first,last,email,quote) VALUES ('178','Delilah','Horton','tincidunt.nunc@arcuet.ca','nec ante. Maecenas mi');
INSERT INTO users (code,first,last,email,quote) VALUES ('179','Isaiah','Buckley','Fusce.feugiat@massa.org','ut');
INSERT INTO users (code,first,last,email,quote) VALUES ('180','Logan','Jacobs','Phasellus@utsemNulla.ca','ullamcorper eu, euismod');
INSERT INTO users (code,first,last,email,quote) VALUES ('181','Lesley','Brown','fringilla@erateget.com','nostra, per inceptos');
INSERT INTO users (code,first,last,email,quote) VALUES ('182','Kay','Dodson','a.purus@velpedeblandit.ca','tortor at risus. Nunc ac sem ut');
INSERT INTO users (code,first,last,email,quote) VALUES ('183','Yeo','Hayes','vitae.posuere.at@scelerisque.com','a, dui. Cras');
INSERT INTO users (code,first,last,email,quote) VALUES ('184','Keegan','Brock','molestie.tellus@convallisestvitae.ca','mi eleifend egestas. Sed pharetra, felis eget varius ultrices,');
INSERT INTO users (code,first,last,email,quote) VALUES ('185','Kim','Foley','at@acrisusMorbi.com','scelerisque sed, sapien.');
INSERT INTO users (code,first,last,email,quote) VALUES ('186','Celeste','Delacruz','ipsum.non.arcu@vulputate.edu','Donec fringilla. Donec feugiat metus');
INSERT INTO users (code,first,last,email,quote) VALUES ('187','Hilda','Rowe','gravida.sit@nisi.ca','eu nulla at sem molestie sodales. Mauris blandit enim');
INSERT INTO users (code,first,last,email,quote) VALUES ('188','Fuller','Mclaughlin','purus.gravida.sagittis@arcu.com','erat. Sed nunc est, mollis non, cursus non, egestas a,');
INSERT INTO users (code,first,last,email,quote) VALUES ('189','Madeline','Henderson','lorem.fringilla@cursusdiam.com','Sed pharetra, felis eget varius ultrices, mauris');
INSERT INTO users (code,first,last,email,quote) VALUES ('190','Josephine','Osborn','metus@tincidunt.ca','a sollicitudin orci sem eget massa. Suspendisse');
INSERT INTO users (code,first,last,email,quote) VALUES ('191','Ivana','Jimenez','justo@egestasSedpharetra.org','Duis risus odio, auctor vitae, aliquet nec, imperdiet nec, leo.');
INSERT INTO users (code,first,last,email,quote) VALUES ('192','Stephanie','Dickerson','aliquet.nec.imperdiet@Aliquamrutrumlorem.com','nec ante. Maecenas mi felis, adipiscing');
INSERT INTO users (code,first,last,email,quote) VALUES ('193','Yardley','Trevino','lacinia.mattis@porttitoreros.edu','lacus.');
INSERT INTO users (code,first,last,email,quote) VALUES ('194','Carol','Acosta','Donec@aliquetmolestie.ca','arcu');
INSERT INTO users (code,first,last,email,quote) VALUES ('195','Lysandra','Mosley','imperdiet@Suspendissesed.org','viverra. Maecenas iaculis aliquet diam.');
INSERT INTO users (code,first,last,email,quote) VALUES ('196','Tamara','Solis','eleifend.egestas.Sed@duiinsodales.com','sit amet lorem semper auctor. Mauris vel');
INSERT INTO users (code,first,last,email,quote) VALUES ('197','Palmer','Perez','nibh@nonduinec.edu','lacus vestibulum lorem, sit amet');
INSERT INTO users (code,first,last,email,quote) VALUES ('198','Maia','Donaldson','gravida.Aliquam.tincidunt@volutpatNulladignissim.edu','sit amet luctus vulputate, nisi');
INSERT INTO users (code,first,last,email,quote) VALUES ('199','Murphy','Wright','et.pede@aptenttacitisociosqu.ca','non arcu. Vivamus sit amet risus. Donec egestas.');
INSERT INTO users (code,first,last,email,quote) VALUES ('200','Omar','Campos','nunc.ac.mattis@luctussitamet.edu','parturient');
UPDATE users SET login = lower(first || '.' || last);</value>
</data>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="UsersTable" xml:space="preserve">
<value>CREATE TABLE sample_users (id INTEGER NOT NULL PRIMARY KEY, code, login text, first text, last text, password text, email text, quote text);
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('1','Clarke','Jarvis','eu.accumsan@nonarcuVivamus.org','non leo. Vivamus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('2','Marny','Fry','Cras.convallis.convallis@nisiCumsociis.ca','aliquam eu, accumsan sed, facilisis vitae, orci. Phasellus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('3','Dai','Marks','dictum.augue@venenatis.ca','nulla ante, iaculis nec, eleifend non, dapibus rutrum, justo. Praesent');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('4','Forrest','Hendricks','justo.sit.amet@odioa.edu','auctor. Mauris vel turpis. Aliquam adipiscing lobortis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('5','Blossom','Dunlap','libero.mauris@Phasellusfermentumconvallis.ca','luctus sit amet, faucibus ut, nulla. Cras eu tellus eu');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('6','George','Rios','vitae@sodales.ca','elit. Aliquam auctor, velit eget laoreet');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('7','Ivory','Henderson','elit.Aliquam.auctor@Nullamvelitdui.ca','Fusce diam nunc, ullamcorper');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('8','Inez','Goodwin','consectetuer.mauris@nibhPhasellus.edu','eu, placerat eget, venenatis a, magna.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('9','Sigourney','Gonzales','lectus.pede.ultrices@sagittislobortismauris.org','egestas hendrerit');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('10','Fulton','Terrell','penatibus@euaugue.com','Nulla interdum. Curabitur dictum.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('11','Logan','Freeman','malesuada.malesuada@nullaIntegervulputate.edu','dui, semper et, lacinia');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('12','Anne','Irwin','lorem.ut.aliquam@ligula.org','erat, in consectetuer ipsum nunc id enim.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('13','Alexandra','Church','sit@sempererat.org','lorem, luctus ut, pellentesque eget, dictum placerat, augue. Sed');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('14','Adena','Branch','sit.amet@accumsanlaoreetipsum.org','natoque penatibus et');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('15','Lionel','Hoover','ac@Donectempor.ca','at pede. Cras vulputate');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('16','Aimee','Strickland','ornare.lectus@tinciduntduiaugue.ca','vitae odio sagittis semper. Nam');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('17','Selma','Williamson','metus.In.nec@quamquisdiam.org','id nunc');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('18','Lara','Trujillo','lacus@convallisest.edu','Integer sem elit, pharetra ut,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('19','Ori','Ellis','egestas@at.ca','odio. Nam interdum');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('20','Macey','Carey','sed.consequat@ametorciUt.org','magna');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('21','Quynn','Randall','Cras.dictum@malesuada.org','egestas. Fusce aliquet magna a neque.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('22','Alec','Robles','Fusce.feugiat@mollisdui.com','a');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('23','Jakeem','Bell','ante@laoreetlectusquis.edu','eget massa. Suspendisse eleifend. Cras');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('24','Katelyn','Cannon','sit.amet@PhasellusornareFusce.org','nisi dictum augue malesuada malesuada.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('25','Christian','Alford','per@vulputate.ca','turpis.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('26','Leila','Forbes','nec.ante@idblanditat.ca','ac ipsum. Phasellus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('27','Hadley','Gillespie','Lorem.ipsum@Nullamvitaediam.com','vestibulum lorem, sit amet ultricies sem magna nec quam.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('28','Julian','Keith','facilisis@loremvitaeodio.edu','nulla at sem molestie sodales. Mauris blandit enim consequat purus.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('29','Allen','Ramos','neque@lobortis.ca','amet diam eu dolor egestas rhoncus. Proin nisl sem, consequat');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('30','Hermione','Walsh','dictum.magna@tincidunt.edu','scelerisque');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('31','Xena','Graves','eu.dui@tinciduntaliquamarcu.ca','nunc interdum feugiat. Sed nec metus facilisis lorem tristique aliquet.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('32','Tanisha','Blackburn','aliquam.eu.accumsan@dui.edu','fringilla mi lacinia mattis. Integer eu');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('33','Norman','Hobbs','eu.euismod.ac@tinciduntDonecvitae.com','pulvinar arcu et pede. Nunc');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('34','Guy','Molina','non@rutrumurna.org','Vivamus euismod urna.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('35','Rama','Albert','nunc@laciniavitaesodales.com','eu augue porttitor interdum. Sed auctor odio a purus. Duis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('36','Owen','Combs','Nullam.enim.Sed@magnaPhasellusdolor.com','mollis vitae, posuere at, velit. Cras lorem lorem, luctus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('37','Ashely','Graham','eget.odio@enimsitamet.com','commodo at, libero. Morbi accumsan laoreet ipsum. Curabitur consequat,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('38','Paul','Levy','nec@leo.com','augue scelerisque mollis. Phasellus libero mauris, aliquam eu, accumsan');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('39','Octavia','Calderon','eu@maurissitamet.edu','est, mollis non, cursus non,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('40','Lenore','Pugh','eu.metus.In@Cumsociisnatoque.com','scelerisque mollis. Phasellus libero mauris, aliquam eu, accumsan sed, facilisis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('41','Regan','Clemons','eu.neque.pellentesque@Integerinmagna.ca','Curae;');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('42','Zachary','Haynes','eu.erat@ipsum.edu','quis lectus. Nullam');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('43','Dane','Hyde','rhoncus@auctor.com','magna et ipsum cursus vestibulum. Mauris magna. Duis dignissim');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('44','Mara','Hansen','Nunc.commodo@ultricies.org','magna. Ut tincidunt orci quis lectus. Nullam suscipit, est');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('45','Zelda','Parrish','turpis.In@rutrummagnaCras.com','Suspendisse aliquet, sem ut cursus luctus, ipsum leo');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('46','Amaya','Richmond','lacinia.at@in.org','ac, fermentum vel, mauris.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('47','Hedda','Murray','ac.fermentum.vel@ipsum.com','tincidunt, neque vitae semper egestas, urna justo faucibus lectus, a');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('48','Brendan','Macdonald','dignissim@leoMorbi.com','vestibulum lorem, sit');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('49','Gray','Mccall','risus.Donec@atsem.ca','libero est, congue');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('50','Shoshana','Tran','nunc.In@aliquet.org','magna sed dui.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('51','Sylvester','Parks','Mauris.molestie@ipsumdolorsit.org','nec, eleifend non, dapibus rutrum, justo.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('52','Kennan','Stokes','nonummy.ut.molestie@varius.org','Ut nec urna et arcu imperdiet ullamcorper. Duis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('53','Quin','Park','porttitor@vulputateeu.com','scelerisque, lorem ipsum sodales');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('54','Madison','Bailey','nec.orci.Donec@vestibulumnequesed.org','augue. Sed');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('55','Kenyon','Reilly','ultrices.iaculis.odio@sit.ca','enim. Curabitur massa. Vestibulum accumsan neque');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('56','Drew','Brooks','molestie.orci@aliquetdiamSed.org','at risus. Nunc ac sem ut dolor dapibus gravida.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('57','Omar','Dunn','vel@Donecsollicitudinadipiscing.ca','ultrices posuere cubilia Curae; Phasellus ornare. Fusce mollis. Duis sit');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('58','Glenna','Lambert','Proin.non@Phasellus.com','neque. In');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('59','Aspen','Bailey','in.dolor.Fusce@ipsum.org','a, arcu. Sed et libero. Proin');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('60','Adele','Carlson','velit.justo.nec@vehicularisusNulla.edu','risus.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('61','Kerry','Zimmerman','luctus.aliquet.odio@urnajusto.edu','purus. Duis elementum, dui quis accumsan convallis, ante lectus convallis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('62','Hedda','Guthrie','vulputate.risus@Phaselluselit.ca','ac mattis velit justo nec');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('63','Wyoming','Blackburn','nec.ante@lorem.org','ultricies');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('64','Palmer','Dennis','venenatis.lacus@Donecnonjusto.org','a, arcu. Sed et libero. Proin');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('65','Wesley','Reeves','massa.Suspendisse.eleifend@nec.edu','consequat');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('66','Mallory','Todd','Duis@Crasloremlorem.edu','nascetur ridiculus mus. Proin vel arcu eu odio');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('67','Perry','Kirk','tincidunt.adipiscing@mauris.ca','ullamcorper viverra. Maecenas iaculis aliquet diam. Sed diam lorem,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('68','Justina','Horne','enim.nec.tempus@magnanec.com','ipsum ac mi eleifend egestas. Sed pharetra, felis eget');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('69','Noel','Santana','Duis.elementum.dui@Nullamvitae.org','Phasellus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('70','Sylvester','Bridges','Sed.neque@ornarelectusante.org','Maecenas libero');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('71','Cailin','Baldwin','eu@nibhenim.com','consectetuer');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('72','Beatrice','Henson','risus.Nunc.ac@Etiam.ca','nec, imperdiet nec, leo. Morbi neque');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('73','Kellie','Curry','quis.turpis.vitae@Quisque.org','ipsum. Suspendisse non leo.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('74','Justine','Stewart','Curabitur@dui.org','natoque penatibus et magnis dis parturient');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('75','Dean','Waters','quis.turpis@morbi.ca','Nulla interdum. Curabitur dictum. Phasellus in felis. Nulla tempor augue');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('76','Helen','Porter','molestie.dapibus.ligula@ipsum.com','enim non nisi. Aenean eget');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('77','Janna','Acosta','lectus.a@tempusrisus.com','lectus justo');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('78','Libby','Vaughn','nisl.sem.consequat@convallis.ca','purus mauris a nunc.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('79','Winifred','Cooke','aliquet.sem.ut@etrutrum.ca','metus facilisis lorem tristique aliquet. Phasellus fermentum convallis ligula. Donec');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('80','Taylor','Glass','sit@maurissitamet.com','orci, consectetuer euismod');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('81','Melyssa','Palmer','pharetra.sed.hendrerit@fermentum.ca','neque tellus, imperdiet non, vestibulum nec,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('82','Kuame','Holman','Vivamus@Donecnibh.edu','cursus non, egestas a, dui. Cras');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('83','Martin','Hughes','magna@nonbibendum.org','et ultrices posuere cubilia');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('84','Roanna','Potter','amet.dapibus@aenim.com','est tempor bibendum. Donec');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('85','Cleo','Carson','Curabitur.dictum.Phasellus@liberoIntegerin.com','mauris');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('86','Adele','Daugherty','vulputate.ullamcorper@elitfermentumrisus.edu','consequat purus. Maecenas');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('87','Macon','Todd','et.malesuada@Crasloremlorem.com','montes, nascetur ridiculus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('88','Ira','Merritt','risus@eunullaat.ca','metus.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('89','Dustin','Landry','nec.orci.Donec@vulputateeu.com','Nunc pulvinar arcu et pede. Nunc sed');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('90','Debra','Shepherd','dolor.elit@ornareFusce.ca','Suspendisse non leo. Vivamus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('91','Channing','Mcknight','tellus@laoreet.ca','non ante bibendum ullamcorper. Duis cursus, diam at pretium aliquet,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('92','Abraham','Rodgers','tincidunt.nibh@ipsum.ca','Cum sociis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('93','Abel','Mcintyre','et@turpisvitaepurus.com','at pretium aliquet,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('94','Lysandra','Cotton','malesuada.malesuada.Integer@gravidamolestie.org','commodo hendrerit. Donec');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('95','Kane','Bennett','ante.Vivamus@Donec.ca','consectetuer rhoncus. Nullam velit dui, semper et, lacinia vitae, sodales');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('96','Timothy','Rivas','hendrerit.consectetuer@nonarcuVivamus.ca','Suspendisse non leo. Vivamus nibh dolor, nonummy ac, feugiat');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('97','Arden','Cote','magnis@sedestNunc.org','purus mauris a nunc.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('98','Brynn','Britt','ac@nibhQuisque.edu','Duis gravida. Praesent eu nulla at sem molestie');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('99','Jerome','Kirkland','ac@nibhPhasellus.com','neque');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('100','Hoyt','Tran','ullamcorper.viverra@parturientmontesnascetur.org','ac tellus. Suspendisse sed dolor. Fusce mi');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('101','Abraham','Downs','velit.eu.sem@neceuismod.ca','suscipit,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('102','Vivien','Fletcher','Nunc.ut@quamPellentesquehabitant.edu','lobortis. Class aptent taciti sociosqu ad');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('103','Azalia','Turner','scelerisque@at.edu','odio sagittis semper. Nam tempor diam dictum');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('104','Tate','Ellis','velit.Sed.malesuada@Cras.com','sed');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('105','Dennis','Walls','Nullam.scelerisque@amifringilla.edu','arcu. Vestibulum ut eros non enim commodo hendrerit. Donec porttitor');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('106','Amela','Collins','Quisque@magna.org','Proin');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('107','Olivia','Dejesus','scelerisque@vitae.org','Duis cursus, diam at pretium aliquet,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('108','Mechelle','Russo','Fusce.aliquet.magna@Praesent.org','penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('109','Hall','Burke','Vivamus.nibh@pellentesque.edu','et libero. Proin mi. Aliquam');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('110','Chanda','Ayers','magna.Nam.ligula@NullafacilisiSed.org','dui, semper et, lacinia vitae, sodales at,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('111','Abdul','Dominguez','pretium.aliquet.metus@vellectusCum.com','vitae erat vel pede blandit congue. In scelerisque scelerisque dui.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('112','Wynter','Lynn','tellus.Aenean@ligulatortordictum.ca','adipiscing fringilla, porttitor vulputate, posuere vulputate, lacus. Cras interdum.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('113','Molly','Willis','montes.nascetur@sed.org','sem. Nulla interdum. Curabitur dictum. Phasellus in felis.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('114','Shafira','Harper','Phasellus.in.felis@ategestas.edu','Vivamus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('115','Otto','Gentry','in.molestie.tortor@Fusce.edu','est. Mauris eu turpis. Nulla aliquet. Proin velit.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('116','Todd','Riddle','et@nislsem.com','Nulla');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('117','Mufutau','Pollard','sit@ridiculusmus.org','accumsan neque et nunc. Quisque ornare tortor at');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('118','Noah','Sears','tristique.neque.venenatis@luctuslobortis.org','dictum');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('119','Amanda','Clarke','in.consequat@non.org','nisi dictum augue malesuada malesuada. Integer id magna et ipsum');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('120','Vladimir','Colon','velit.dui@scelerisquenequeNullam.com','pharetra sed, hendrerit a, arcu. Sed et libero.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('121','Aaron','Hernandez','Quisque.ornare.tortor@magna.ca','sit amet ante. Vivamus non lorem vitae odio');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('122','Bert','Gonzales','fermentum@Nullamvelit.ca','quis massa. Mauris vestibulum, neque sed dictum eleifend, nunc');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('123','Bevis','Leblanc','viverra.Donec@dictumaugue.com','neque sed dictum eleifend, nunc risus varius orci, in');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('124','Noble','Fisher','Cum@eu.com','Nunc quis arcu');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('125','Xaviera','Barton','non.arcu@sagittis.com','ultrices posuere cubilia Curae; Phasellus ornare. Fusce mollis. Duis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('126','Logan','Roy','Nulla@hendreritconsectetuercursus.com','sed, facilisis vitae, orci. Phasellus dapibus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('127','Wilma','Sweet','Nullam.nisl.Maecenas@gravidasagittis.org','ut, nulla. Cras');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('128','Candace','Olsen','sit.amet@lobortisnisi.com','habitant morbi tristique senectus et netus et malesuada');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('129','Claire','Alvarado','risus.varius@interdumSed.com','a felis ullamcorper viverra. Maecenas iaculis aliquet');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('130','Aurelia','Bean','diam.dictum.sapien@eu.edu','libero. Integer in magna. Phasellus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('131','Carly','Wilcox','massa.non.ante@Aliquam.com','vehicula risus. Nulla eget metus eu erat semper rutrum. Fusce');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('132','Xanthus','Graves','vulputate.velit.eu@vitaerisus.com','Cras sed leo. Cras vehicula aliquet libero. Integer in magna.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('133','Uta','Justice','adipiscing@consequatdolor.edu','Nam tempor diam dictum sapien. Aenean massa.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('134','Alika','Parker','faucibus.ut@Fuscemilorem.edu','vel, venenatis vel, faucibus id,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('135','Kasimir','Pugh','sed.turpis@FuscefeugiatLorem.com','justo. Praesent luctus. Curabitur egestas nunc');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('136','Brock','Acevedo','dapibus.rutrum@convallisconvallisdolor.org','eu enim. Etiam');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('137','Orla','Hogan','in@Aliquamauctor.com','ac turpis egestas. Aliquam fringilla cursus purus. Nullam scelerisque neque');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('138','Tatyana','Bean','molestie.arcu@sempercursus.edu','pellentesque, tellus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('139','Cadman','Humphrey','auctor@Aeneangravida.edu','eget, dictum');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('140','Delilah','Quinn','Pellentesque.habitant@liberoMorbi.edu','lobortis quam a felis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('141','Briar','Prince','euismod@Aeneangravida.com','at, libero.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('142','Hedda','Garrett','eleifend@sitamet.org','ac turpis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('143','Sage','Hardy','semper@acfeugiat.org','Nunc laoreet lectus quis massa.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('144','Iris','Meyers','Duis.a.mi@Donecnibhenim.edu','vitae aliquam eros turpis non enim. Mauris quis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('145','Hayes','Bates','molestie@magnaSuspendisse.com','fringilla. Donec feugiat metus sit amet ante.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('146','Rana','Cain','malesuada@loremsitamet.edu','mi');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('147','acqueline','Mays','est.Nunc.laoreet@est.edu','odio. Phasellus at augue id ante dictum cursus. Nunc');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('148','Nichole','Suarez','cursus.purus.Nullam@ac.edu','Sed malesuada augue ut lacus. Nulla');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('149','Sasha','Sparks','fermentum@nonenim.edu','Sed dictum. Proin eget odio.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('150','Timon','Lowery','suscipit@Donecat.edu','pede blandit congue. In scelerisque scelerisque dui. Suspendisse ac metus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('151','Ivor','Charles','augue.eu@odiovelest.org','quis urna. Nunc quis arcu vel quam dignissim');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('152','Joelle','Trevino','eget@diamdictumsapien.ca','tortor, dictum eu, placerat eget, venenatis a,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('153','Aristotle','Wall','at@Pellentesqueutipsum.com','quis,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('154','Amena','Boyd','elit.Etiam@vehiculaet.com','molestie dapibus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('155','Rashad','Osborn','ac@aliquam.ca','sed');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('156','Theodore','Williamson','dignissim.magna@volutpat.ca','Fusce fermentum fermentum');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('157','Rajah','Logan','enim@Aliquamerat.com','nunc. Quisque ornare tortor');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('158','Zane','Perez','aliquet@aliquetPhasellus.com','pede.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('159','Jena','Rios','urna@velitegetlaoreet.org','eu erat semper rutrum.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('160','Amber','Gallagher','conubia@elit.org','Maecenas ornare egestas');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('161','Veda','Pittman','habitant.morbi.tristique@aliquamenimnec.ca','risus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('162','Nathan','Lowe','dui.Cum.sociis@Sed.org','sed, est. Nunc');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('163','Matthew','Townsend','commodo.auctor.velit@egestasadui.ca','ligula. Aenean euismod');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('164','Oscar','Richards','vulputate.ullamcorper@eueleifendnec.ca','laoreet ipsum. Curabitur consequat, lectus sit');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('165','Gareth','Jackson','nec.diam.Duis@nisl.com','iaculis nec, eleifend non, dapibus rutrum, justo. Praesent luctus.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('166','Alice','Hyde','Sed.auctor.odio@tortor.edu','id, libero. Donec consectetuer mauris id sapien. Cras dolor');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('167','Giacomo','Ramos','et.ipsum.cursus@massanon.edu','auctor non, feugiat nec, diam. Duis');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('168','Ciara','Jacobson','Donec.egestas.Aliquam@Aeneangravidanunc.edu','molestie tellus.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('169','Logan','Hendricks','luctus@vulputatedui.ca','in, cursus et, eros. Proin ultrices. Duis volutpat nunc');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('170','MacKenzie','Campos','luctus.ut.pellentesque@pellentesquea.edu','erat,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('171','Nina','Best','purus.sapien@aliquet.ca','dolor sit amet, consectetuer');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('172','Chester','Howe','Cum.sociis.natoque@Duis.ca','dui, nec tempus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('173','Nora','Callahan','in.hendrerit@ametconsectetueradipiscing.com','tempus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('174','Molly','Bray','consectetuer@velitSedmalesuada.edu','lorem fringilla ornare placerat, orci lacus vestibulum lorem, sit');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('175','Ariel','Osborn','et@Aeneanegestashendrerit.ca','enim. Sed nulla ante, iaculis nec,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('176','Arsenio','Leblanc','Pellentesque.ut.ipsum@nibh.com','elit pede, malesuada vel, venenatis vel, faucibus id, libero.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('177','Deborah','Bowman','enim.Etiam@primisinfaucibus.ca','eu nibh vulputate mauris');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('178','Delilah','Horton','tincidunt.nunc@arcuet.ca','nec ante. Maecenas mi');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('179','Isaiah','Buckley','Fusce.feugiat@massa.org','ut');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('180','Logan','Jacobs','Phasellus@utsemNulla.ca','ullamcorper eu, euismod');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('181','Lesley','Brown','fringilla@erateget.com','nostra, per inceptos');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('182','Kay','Dodson','a.purus@velpedeblandit.ca','tortor at risus. Nunc ac sem ut');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('183','Yeo','Hayes','vitae.posuere.at@scelerisque.com','a, dui. Cras');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('184','Keegan','Brock','molestie.tellus@convallisestvitae.ca','mi eleifend egestas. Sed pharetra, felis eget varius ultrices,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('185','Kim','Foley','at@acrisusMorbi.com','scelerisque sed, sapien.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('186','Celeste','Delacruz','ipsum.non.arcu@vulputate.edu','Donec fringilla. Donec feugiat metus');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('187','Hilda','Rowe','gravida.sit@nisi.ca','eu nulla at sem molestie sodales. Mauris blandit enim');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('188','Fuller','Mclaughlin','purus.gravida.sagittis@arcu.com','erat. Sed nunc est, mollis non, cursus non, egestas a,');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('189','Madeline','Henderson','lorem.fringilla@cursusdiam.com','Sed pharetra, felis eget varius ultrices, mauris');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('190','Josephine','Osborn','metus@tincidunt.ca','a sollicitudin orci sem eget massa. Suspendisse');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('191','Ivana','Jimenez','justo@egestasSedpharetra.org','Duis risus odio, auctor vitae, aliquet nec, imperdiet nec, leo.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('192','Stephanie','Dickerson','aliquet.nec.imperdiet@Aliquamrutrumlorem.com','nec ante. Maecenas mi felis, adipiscing');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('193','Yardley','Trevino','lacinia.mattis@porttitoreros.edu','lacus.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('194','Carol','Acosta','Donec@aliquetmolestie.ca','arcu');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('195','Lysandra','Mosley','imperdiet@Suspendissesed.org','viverra. Maecenas iaculis aliquet diam.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('196','Tamara','Solis','eleifend.egestas.Sed@duiinsodales.com','sit amet lorem semper auctor. Mauris vel');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('197','Palmer','Perez','nibh@nonduinec.edu','lacus vestibulum lorem, sit amet');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('198','Maia','Donaldson','gravida.Aliquam.tincidunt@volutpatNulladignissim.edu','sit amet luctus vulputate, nisi');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('199','Murphy','Wright','et.pede@aptenttacitisociosqu.ca','non arcu. Vivamus sit amet risus. Donec egestas.');
INSERT INTO sample_users (code,first,last,email,quote) VALUES ('200','Omar','Campos','nunc.ac.mattis@luctussitamet.edu','parturient');
UPDATE sample_users SET login = lower(first || '.' || last);</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@@ -1,55 +1,55 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Select
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestClass]
public class DynamicNoSchemaAccessTests : DynamicAccessTests
{
/// <summary>Setup test parameters.</summary>
[TestInitialize]
public override void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table("users", new string[] { "id" });
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using NUnit.Framework;
namespace DynamORM.Tests.Select
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestFixture]
public class DynamicNoSchemaAccessTests : DynamicAccessTests
{
/// <summary>Setup test parameters.</summary>
[SetUp]
public override void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table("sample_users", new string[] { "id" });
}
}
}

View File

@@ -1,45 +1,45 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using DynamORM.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Select
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestClass]
public class DynamicTypeSchemaAccessTests : DynamicNoSchemaAccessTests
{
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table<users>();
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using DynamORM.Tests.Helpers;
using NUnit.Framework;
namespace DynamORM.Tests.Select
{
/// <summary>Test standard dynamic access ORM. With out schema information from database.</summary>
[TestFixture]
public class DynamicTypeSchemaAccessTests : DynamicNoSchemaAccessTests
{
/// <summary>Create table using specified method.</summary>
/// <returns>Dynamic table.</returns>
public override dynamic GetTestTable()
{
return Database.Table<sample_users>();
}
}
}

View File

@@ -1,321 +1,321 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Linq;
using DynamORM.Builders;
using DynamORM.Builders.Implementation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Select
{
/// <summary>Tests of legacy parser methods.</summary>
[TestClass]
public class LegacyParserTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[TestInitialize]
public virtual void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Tear down test objects.</summary>
[TestCleanup]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
/// <summary>
/// Tests the where expression equal.
/// </summary>
[TestMethod]
public void TestWhereEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Eq(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" = [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets.
/// </summary>
[TestMethod]
public void TestWhereBracketsEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetEndBlock());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE ((u.\"Deleted\" = [${0}]) AND (u.\"IsActive\" = [${1}]))", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets and or condition.
/// </summary>
[TestMethod]
public void TestWhereBracketsOrEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetOr().SetEndBlock());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE ((u.\"Deleted\" = [${0}]) OR (u.\"IsActive\" = [${1}]))", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets.
/// </summary>
[TestMethod]
public void TestWhereBracketsOrEq2()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Id_User").Greater(1))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetOr().SetEndBlock());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Id_User\" > [${0}]) AND ((u.\"Deleted\" = [${1}]) OR (u.\"IsActive\" = [${2}]))",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2]), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets.
/// </summary>
[TestMethod]
public void TestWhereBracketsOrEqForgotToEnd()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Id_User").Greater(1))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetOr());
using (var con = Database.Open())
using (var c = con.CreateCommand())
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Id_User\" > @0) AND ((u.\"Deleted\" = @1) OR (u.\"IsActive\" = @2))"),
c.SetCommand(cmd).CommandText);
}
/// <summary>
/// Tests the where expression not equal.
/// </summary>
[TestMethod]
public void TestWhereNotEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Not(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" <> [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression greater.
/// </summary>
[TestMethod]
public void TestWhereGreater()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Greater(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" > [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression greater or equal.
/// </summary>
[TestMethod]
public void TestWhereGreaterOrEqual()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").GreaterOrEqual(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" >= [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression less.
/// </summary>
[TestMethod]
public void TestWhereLess()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Less(1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" < [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression less or equal.
/// </summary>
[TestMethod]
public void TestWhereLessOrEqual()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").LessOrEqual(1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" <= [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression like.
/// </summary>
[TestMethod]
public void TestWhereLike()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Like("%1"));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" LIKE [${0}]", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression not like.
/// </summary>
[TestMethod]
public void TestWhereNotLike()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").NotLike("%1"));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" NOT LIKE [${0}]", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression between.
/// </summary>
[TestMethod]
public void TestWhereBetween()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Between(0, 1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" BETWEEN [${0}] AND [${1}]", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression in.
/// </summary>
[TestMethod]
public void TestWhereIn()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").In(0, 1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" IN([${0}], [${1}])", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression using anonymous types.
/// </summary>
[TestMethod]
public void TestWhereAnon()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new { Deleted = 0, IsActive = 1, _table = "u" });
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" = [${0}]) AND (u.\"IsActive\" = [${1}])", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the order by column.
/// </summary>
[TestMethod]
public void TestOrderByCol()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.OrderByColumn(new DynamicColumn("u.Name").Desc());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u ORDER BY u.\"Name\" DESC"), cmd.CommandText());
}
/// <summary>
/// Tests the order by column number.
/// </summary>
[TestMethod]
public void TestOrderByNum()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.OrderByColumn(new DynamicColumn("u.Name").SetAlias("1").Desc());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u ORDER BY 1 DESC"), cmd.CommandText());
}
/// <summary>
/// Tests the group by column.
/// </summary>
[TestMethod]
public void TestGroupByCol()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.GroupByColumn(new DynamicColumn("u.Name"));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u GROUP BY u.\"Name\""), cmd.CommandText());
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Linq;
using DynamORM.Builders;
using DynamORM.Builders.Implementation;
using NUnit.Framework;
namespace DynamORM.Tests.Select
{
/// <summary>Tests of legacy parser methods.</summary>
[TestFixture]
public class LegacyParserTests : TestsBase
{
/// <summary>Setup test parameters.</summary>
[SetUp]
public virtual void SetUp()
{
CreateTestDatabase();
CreateDynamicDatabase(
DynamicDatabaseOptions.SingleConnection |
DynamicDatabaseOptions.SingleTransaction |
DynamicDatabaseOptions.SupportLimitOffset);
}
/// <summary>Tear down test objects.</summary>
[TearDown]
public virtual void TearDown()
{
DestroyDynamicDatabase();
DestroyTestDatabase();
}
/// <summary>
/// Tests the where expression equal.
/// </summary>
[Test]
public void TestWhereEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Eq(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" = [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets.
/// </summary>
[Test]
public void TestWhereBracketsEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetEndBlock());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE ((u.\"Deleted\" = [${0}]) AND (u.\"IsActive\" = [${1}]))", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets and or condition.
/// </summary>
[Test]
public void TestWhereBracketsOrEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetOr().SetEndBlock());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE ((u.\"Deleted\" = [${0}]) OR (u.\"IsActive\" = [${1}]))", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets.
/// </summary>
[Test]
public void TestWhereBracketsOrEq2()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Id_User").Greater(1))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetOr().SetEndBlock());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Id_User\" > [${0}]) AND ((u.\"Deleted\" = [${1}]) OR (u.\"IsActive\" = [${2}]))",
cmd.Parameters.Keys.ToArray()[0], cmd.Parameters.Keys.ToArray()[1], cmd.Parameters.Keys.ToArray()[2]), cmd.CommandText());
}
/// <summary>
/// Tests the where expression equal with brackets.
/// </summary>
[Test]
public void TestWhereBracketsOrEqForgotToEnd()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Id_User").Greater(1))
.Where(new DynamicColumn("u.Deleted").Eq(0).SetBeginBlock())
.Where(new DynamicColumn("u.IsActive").Eq(1).SetOr());
using (var con = Database.Open())
using (var c = con.CreateCommand())
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Id_User\" > @0) AND ((u.\"Deleted\" = @1) OR (u.\"IsActive\" = @2))"),
c.SetCommand(cmd).CommandText);
}
/// <summary>
/// Tests the where expression not equal.
/// </summary>
[Test]
public void TestWhereNotEq()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Not(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" <> [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression greater.
/// </summary>
[Test]
public void TestWhereGreater()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Greater(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" > [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression greater or equal.
/// </summary>
[Test]
public void TestWhereGreaterOrEqual()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").GreaterOrEqual(0));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" >= [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression less.
/// </summary>
[Test]
public void TestWhereLess()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Less(1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" < [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression less or equal.
/// </summary>
[Test]
public void TestWhereLessOrEqual()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").LessOrEqual(1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" <= [${0}])", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression like.
/// </summary>
[Test]
public void TestWhereLike()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Like("%1"));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" LIKE [${0}]", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression not like.
/// </summary>
[Test]
public void TestWhereNotLike()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").NotLike("%1"));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" NOT LIKE [${0}]", cmd.Parameters.Keys.First()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression between.
/// </summary>
[Test]
public void TestWhereBetween()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").Between(0, 1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" BETWEEN [${0}] AND [${1}]", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression in.
/// </summary>
[Test]
public void TestWhereIn()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new DynamicColumn("u.Deleted").In(0, 1));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE u.\"Deleted\" IN([${0}], [${1}])", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the where expression using anonymous types.
/// </summary>
[Test]
public void TestWhereAnon()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.Where(new { Deleted = 0, IsActive = 1, _table = "u" });
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u WHERE (u.\"Deleted\" = [${0}]) AND (u.\"IsActive\" = [${1}])", cmd.Parameters.Keys.First(), cmd.Parameters.Keys.Last()), cmd.CommandText());
}
/// <summary>
/// Tests the order by column.
/// </summary>
[Test]
public void TestOrderByCol()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.OrderByColumn(new DynamicColumn("u.Name").Desc());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u ORDER BY u.\"Name\" DESC"), cmd.CommandText());
}
/// <summary>
/// Tests the order by column number.
/// </summary>
[Test]
public void TestOrderByNum()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.OrderByColumn(new DynamicColumn("u.Name").SetAlias("1").Desc());
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u ORDER BY 1 DESC"), cmd.CommandText());
}
/// <summary>
/// Tests the group by column.
/// </summary>
[Test]
public void TestGroupByCol()
{
IDynamicSelectQueryBuilder cmd = new DynamicSelectQueryBuilder(Database);
cmd.From(x => x.dbo.Users.As(x.u))
.GroupByColumn(new DynamicColumn("u.Name"));
Assert.AreEqual(string.Format("SELECT * FROM \"dbo\".\"Users\" AS u GROUP BY u.\"Name\""), cmd.CommandText());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,150 +1,150 @@
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Collections.Generic;
using System.Linq;
using DynamORM.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DynamORM.Tests.Select
{
/// <summary>Test typed ORM.</summary>
[TestClass]
public class RenamedTypedAccessTests : TypedAccessTests<Users>
{
/// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;</code>.</summary>
[TestMethod]
public override void TestTypedFancyAggregateQuery()
{
var v = (GetTestTable().Query(type: typeof(Users), columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList();
Assert.IsNotNull(v);
Assert.AreEqual(187, v.Count());
Assert.AreEqual(4, v.First().AggregateField);
Assert.AreEqual("Logan", v.First().First);
Assert.AreEqual(2, v.Take(10).Last().AggregateField);
Assert.AreEqual(1, v.Take(11).Last().AggregateField);
Assert.AreEqual(1, v.Last().AggregateField);
}
/// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "users" group by "first" order by 2 desc;</code>.</summary>
[TestMethod]
public override void TestGenericFancyAggregateQuery()
{
var v = (GetTestTable().Query<Users>(columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList();
Assert.IsNotNull(v);
Assert.AreEqual(187, v.Count());
Assert.AreEqual(4, v.First().AggregateField);
Assert.AreEqual("Logan", v.First().First);
Assert.AreEqual(2, v.Take(10).Last().AggregateField);
Assert.AreEqual(1, v.Take(11).Last().AggregateField);
Assert.AreEqual(1, v.Last().AggregateField);
}
/// <summary>Test typed <c>First</c> method.</summary>
[TestMethod]
public override void TestTypedFirst()
{
Assert.AreEqual(1, GetTestTable().First(type: typeof(Users), columns: "id").Id);
}
/// <summary>Test typed <c>Last</c> method.</summary>
[TestMethod]
public override void TestTypedLast()
{
Assert.AreEqual(200, GetTestTable().Last(type: typeof(Users), columns: "id").Id);
}
/// <summary>Test typed <c>Single</c> multi.</summary>
[TestMethod]
public override void TestTypedSingleObject()
{
var exp = new { id = 19, first = "Ori", last = "Ellis" };
var o = GetTestTable().Single(type: typeof(Users), columns: "id,first,last", id: 19);
Assert.AreEqual(exp.id, o.Id);
Assert.AreEqual(exp.first, o.First);
Assert.AreEqual(exp.last, o.Last);
}
/// <summary>Test typed where expression equal.</summary>
[TestMethod]
public override void TestTypedWhereEq()
{
Assert.AreEqual("hoyt.tran", GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("id").Eq(100)).Login);
}
/// <summary>Test typed where expression like.</summary>
[TestMethod]
public override void TestTypedWhereLike()
{
Assert.AreEqual(100, GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("login").Like("Hoyt.%")).Id);
}
/// <summary>Test generic <c>First</c> method.</summary>
[TestMethod]
public override void TestGenericFirst()
{
Assert.AreEqual(1, GetTestTable().First<Users>(columns: "id").Id);
}
/// <summary>Test generic <c>Last</c> method.</summary>
[TestMethod]
public override void TestGenericLast()
{
Assert.AreEqual(200, GetTestTable().Last<Users>(columns: "id").Id);
}
/// <summary>Test generic <c>Single</c> multi.</summary>
[TestMethod]
public override void TestGenericSingleObject()
{
var exp = new { id = 19, first = "Ori", last = "Ellis" };
var o = GetTestTable().Single<Users>(columns: "id,first,last", id: 19);
Assert.AreEqual(exp.id, o.Id);
Assert.AreEqual(exp.first, o.First);
Assert.AreEqual(exp.last, o.Last);
}
/// <summary>Test generic where expression equal.</summary>
[TestMethod]
public override void TestGenericWhereEq()
{
Assert.AreEqual("hoyt.tran", GetTestTable().Single<Users>(where: new DynamicColumn("id").Eq(100)).Login);
}
/// <summary>Test generic where expression like.</summary>
[TestMethod]
public override void TestGenericWhereLike()
{
Assert.AreEqual(100, GetTestTable().Single<Users>(where: new DynamicColumn("login").Like("Hoyt.%")).Id);
}
}
/*
* DynamORM - Dynamic Object-Relational Mapping library.
* Copyright (c) 2012-2026, 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.
*/
using System.Collections.Generic;
using System.Linq;
using DynamORM.Tests.Helpers;
using NUnit.Framework;
namespace DynamORM.Tests.Select
{
/// <summary>Test typed ORM.</summary>
[TestFixture]
public class RenamedTypedAccessTests : TypedAccessTests<Users>
{
/// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "sample_users" group by "first" order by 2 desc;</code>.</summary>
[Test]
public override void TestTypedFancyAggregateQuery()
{
var v = (GetTestTable().Query(type: typeof(Users), columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList();
Assert.IsNotNull(v);
Assert.AreEqual(187, v.Count());
Assert.AreEqual(4, v.First().AggregateField);
Assert.AreEqual("Logan", v.First().First);
Assert.AreEqual(2, v.Take(10).Last().AggregateField);
Assert.AreEqual(1, v.Take(11).Last().AggregateField);
Assert.AreEqual(1, v.Last().AggregateField);
}
/// <summary>Test something fancy... like: <code>select "first", count("first") aggregatefield from "sample_users" group by "first" order by 2 desc;</code>.</summary>
[Test]
public override void TestGenericFancyAggregateQuery()
{
var v = (GetTestTable().Query<Users>(columns: "first,first:AggregateField:count", group: "first", order: ":desc:2") as IEnumerable<dynamic>).ToList();
Assert.IsNotNull(v);
Assert.AreEqual(187, v.Count());
Assert.AreEqual(4, v.First().AggregateField);
Assert.AreEqual("Logan", v.First().First);
Assert.AreEqual(2, v.Take(10).Last().AggregateField);
Assert.AreEqual(1, v.Take(11).Last().AggregateField);
Assert.AreEqual(1, v.Last().AggregateField);
}
/// <summary>Test typed <c>First</c> method.</summary>
[Test]
public override void TestTypedFirst()
{
Assert.AreEqual(1, GetTestTable().First(type: typeof(Users), columns: "id").Id);
}
/// <summary>Test typed <c>Last</c> method.</summary>
[Test]
public override void TestTypedLast()
{
Assert.AreEqual(200, GetTestTable().Last(type: typeof(Users), columns: "id").Id);
}
/// <summary>Test typed <c>Single</c> multi.</summary>
[Test]
public override void TestTypedSingleObject()
{
var exp = new { id = 19, first = "Ori", last = "Ellis" };
var o = GetTestTable().Single(type: typeof(Users), columns: "id,first,last", id: 19);
Assert.AreEqual(exp.id, o.Id);
Assert.AreEqual(exp.first, o.First);
Assert.AreEqual(exp.last, o.Last);
}
/// <summary>Test typed where expression equal.</summary>
[Test]
public override void TestTypedWhereEq()
{
Assert.AreEqual("hoyt.tran", GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("id").Eq(100)).Login);
}
/// <summary>Test typed where expression like.</summary>
[Test]
public override void TestTypedWhereLike()
{
Assert.AreEqual(100, GetTestTable().Single(type: typeof(Users), where: new DynamicColumn("login").Like("Hoyt.%")).Id);
}
/// <summary>Test generic <c>First</c> method.</summary>
[Test]
public override void TestGenericFirst()
{
Assert.AreEqual(1, GetTestTable().First<Users>(columns: "id").Id);
}
/// <summary>Test generic <c>Last</c> method.</summary>
[Test]
public override void TestGenericLast()
{
Assert.AreEqual(200, GetTestTable().Last<Users>(columns: "id").Id);
}
/// <summary>Test generic <c>Single</c> multi.</summary>
[Test]
public override void TestGenericSingleObject()
{
var exp = new { id = 19, first = "Ori", last = "Ellis" };
var o = GetTestTable().Single<Users>(columns: "id,first,last", id: 19);
Assert.AreEqual(exp.id, o.Id);
Assert.AreEqual(exp.first, o.First);
Assert.AreEqual(exp.last, o.Last);
}
/// <summary>Test generic where expression equal.</summary>
[Test]
public override void TestGenericWhereEq()
{
Assert.AreEqual("hoyt.tran", GetTestTable().Single<Users>(where: new DynamicColumn("id").Eq(100)).Login);
}
/// <summary>Test generic where expression like.</summary>
[Test]
public override void TestGenericWhereLike()
{
Assert.AreEqual(100, GetTestTable().Single<Users>(where: new DynamicColumn("login").Like("Hoyt.%")).Id);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,10 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DynamORM", "DynamORM\DynamO
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamORM.Tests", "DynamORM.Tests\DynamORM.Tests.csproj", "{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AmalgamationTool", "AmalgamationTool\AmalgamationTool.csproj", "{A64D2052-D0CD-488E-BF05-E5952615D926}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tester", "Tester\Tester.csproj", "{F747AA57-BEA7-4FB8-B371-546296789AEF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AmalgamationTool", "AmalgamationTool\AmalgamationTool.csproj", "{A64D2052-D0CD-488E-BF05-E5952615D926}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -41,29 +39,18 @@ Global
{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D5013B4E-8A1B-4DBB-8FB5-E09935F4F764}.Release|x86.ActiveCfg = Release|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Any CPU.ActiveCfg = Debug|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Any CPU.Build.0 = Debug|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|x86.ActiveCfg = Debug|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|x86.Build.0 = Debug|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Any CPU.ActiveCfg = Release|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Any CPU.Build.0 = Release|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Mixed Platforms.Build.0 = Release|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|x86.ActiveCfg = Release|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|x86.Build.0 = Release|x86
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Debug|x86.ActiveCfg = Debug|x86
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Debug|x86.Build.0 = Debug|x86
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Release|Any CPU.ActiveCfg = Release|x86
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Release|x86.ActiveCfg = Release|x86
{F747AA57-BEA7-4FB8-B371-546296789AEF}.Release|x86.Build.0 = Release|x86
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|x86.ActiveCfg = Debug|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Debug|x86.Build.0 = Debug|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Any CPU.Build.0 = Release|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|x86.ActiveCfg = Release|Any CPU
{A64D2052-D0CD-488E-BF05-E5952615D926}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -72,6 +59,6 @@ Global
SolutionGuid = {22781EB3-2148-4CA4-845A-B55265A7B5C2}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Tester\Tester.csproj
EndGlobalSection
EndGlobal
StartupItem = DynamORM.Tests\DynamORM.Tests.csproj
EndGlobalSection
EndGlobal

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net472;net6.0;net8.0;net10.0</TargetFrameworks>
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net472;net6.0;net8.0;net10.0</TargetFrameworks>
<Description>Dynamic Object-Relational Mapping library.</Description>
<Copyright>Copyright © RUSSEK Software 2012-2026</Copyright>
<Company>RUSSEK Software</Company>
@@ -10,8 +10,14 @@
<RepositoryUrl>https://git.dr4cul4.pl/RUSSEK-Software/DynamORM</RepositoryUrl>
<PackageProjectUrl>https://dr4cul4.pl</PackageProjectUrl>
<Product>DynamORM</Product>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>
<PropertyGroup>
<GenerateAmalgamationOnBuild>true</GenerateAmalgamationOnBuild>
<AmalgamationSourceDir>$(MSBuildProjectDirectory)</AmalgamationSourceDir>
<AmalgamationOutputFile>$(MSBuildProjectDirectory)\..\AmalgamationTool\DynamORM.Amalgamation.cs</AmalgamationOutputFile>
</PropertyGroup>
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
@@ -22,7 +28,14 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
</ItemGroup>
</Project>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
</ItemGroup>
<Target Name="GenerateAmalgamation"
AfterTargets="Build"
Condition="'$(GenerateAmalgamationOnBuild)' == 'true' and '$(TargetFramework)' == 'net10.0' and '$(IsCrossTargetingBuild)' != 'true'">
<Message Importance="high" Text="Generating amalgamation file to $(AmalgamationOutputFile)" />
<Exec Command="dotnet run --project &quot;$(MSBuildProjectDirectory)\..\AmalgamationTool\AmalgamationTool.csproj&quot; -- &quot;$(AmalgamationSourceDir)&quot; &quot;$(AmalgamationOutputFile)&quot;" />
</Target>
</Project>

View File

@@ -51,11 +51,11 @@ namespace DynamORM
/// public class ProcResult { [Column("outp")] public Guid Output { get; set; } }
/// ProcResult res4 = db.Procedures.sp_Test_Scalar_In_Out&lt;ProcResult&gt;(inp: Guid.NewGuid(), out_outp: Guid.Empty) as ProcResult;
/// </code>As you can se, you can use mapper to do job for you.</example>
public class DynamicProcedureInvoker : DynamicObject, IDisposable
{
private DynamicDatabase _db;
private List<string> _prefixes;
private bool _isDisposed;
public class DynamicProcedureInvoker : DynamicObject, IDisposable
{
private DynamicDatabase _db;
private List<string> _prefixes;
private bool _isDisposed;
internal DynamicProcedureInvoker(DynamicDatabase db, List<string> prefixes = null)
{
@@ -314,8 +314,6 @@ namespace DynamORM
Type listType = typeof(List<>).MakeGenericType(new Type[] { argType });
IList listInstance = (IList)Activator.CreateInstance(listType);
object defVal = listType.GetDefaultValue();
using (IDataReader rdr = cmd.ExecuteReader())
using (IDataReader cache = rdr.CachedReader())
while (cache.Read())
@@ -447,16 +445,16 @@ namespace DynamORM
return true;
}
/// <summary>Performs application-defined tasks associated with
/// freeing, releasing, or resetting unmanaged resources.</summary>
public void Dispose()
{
if (_isDisposed)
return;
_isDisposed = true;
_db = null;
_prefixes = null;
}
}
}
/// <summary>Performs application-defined tasks associated with
/// freeing, releasing, or resetting unmanaged resources.</summary>
public void Dispose()
{
if (_isDisposed)
return;
_isDisposed = true;
_db = null;
_prefixes = null;
}
}
}

View File

@@ -22,3 +22,4 @@ Full documentation is available in [`docs/README.md`](docs/README.md):
- `DynamORM.Tests/`: test suite
- `AmalgamationTool/`: amalgamation generator and generated single-file output
- `DynamORM.Net40.csproj`: net40 build for amalgamated source compatibility
- `scripts/docker/`: dockerized build, test, amalgamation generation, and mono net40 smoke scripts

View File

@@ -1,169 +0,0 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using DynamORM;
using DynamORM.Helpers;
using DynamORM.Mapper;
using Tester.RealTests;
namespace Tester
{
internal class Program
{
private static DynamicDatabase GetORM()
{
return new DynamicDatabase(System.Data.SqlClient.SqlClientFactory.Instance,
//"packet size=4096;User Id=sa;Password=sWe7PepR;data source=192.168.22.10;initial catalog=PLAYGROUND;",
"packet size=4096;User Id=sa;Password=sWe7PepR;data source=192.168.22.10;initial catalog=MOM_DEMO_WMS_FILLED;",
DynamicDatabaseOptions.SingleConnection | DynamicDatabaseOptions.SingleTransaction | DynamicDatabaseOptions.SupportSchema |
DynamicDatabaseOptions.SupportStoredProcedures | DynamicDatabaseOptions.SupportTop | DynamicDatabaseOptions.DumpCommands |
DynamicDatabaseOptions.SupportStoredProceduresResult);
////return new DynamORM.DynamicDatabase(System.Data.SQLite.SQLiteFactory.Instance,
//// "Data Source=test.db3;",
//// DynamORM.DynamicDatabaseOptions.SingleConnection | DynamORM.DynamicDatabaseOptions.SingleTransaction |
//// DynamORM.DynamicDatabaseOptions.SupportSchema | DynamORM.DynamicDatabaseOptions.SupportLimitOffset);
///
}
private static void Main(string[] args)
{
using (var db = GetORM())
{
var num = db.Procedures.usp_NewNumber(counterName: "TRAY");
//ProcedureHell(db);
//OddNullabeleProblem.Test(db);
//TableFun(db);
}
}
private static void TableFun(DynamicDatabase db)
{
try
{
db.Execute("DROP TABLE Experiments ");
}
catch { }
db.Execute(@"CREATE TABLE Experiments (
id int NOT NULL PRIMARY KEY,
t1 nvarchar(50) NOT NULL DEFAULT N'',
t2 varchar(50) NOT NULL DEFAULT '',
dd date,
tt time);");
db.Insert<Ex>().Insert(new Ex
{
id = 1,
t1 = "T1",
t2 = "T1",
dd = DateTime.Now,
tt = TimeSpan.FromDays(2) + TimeSpan.FromHours(10),
}).Execute();
var tt = db.From<Ex>().Where(x => x.id == 1).ToList<Ex>().FirstOrDefault();
db.Update<Ex>().Where(x => x.id == 1).Set(x => x.tt = TimeSpan.FromMinutes(10), x => x.dd = DateTime.Now.AddDays(2)).Execute();
db.Execute("DROP TABLE Experiments ");
}
[Table(Name = "Experiments")]
private class Ex
{
public int id { get; set; }
public string t1 { get; set; }
public string t2 { get; set; }
public DateTime dd { get; set; }
public TimeSpan tt { get; set; }
}
private static void ProcedureHell(DynamicDatabase db)
{
db.Execute(@"CREATE OR ALTER PROCEDURE sp_Exp_Scalar AS SELECT 42;");
var res0 = db.Procedures.sp_Exp_Scalar();
var res1 = db.Procedures.sp_Exp_Scalar<int>();
db.Execute(@"CREATE OR ALTER PROCEDURE sp_Exp_ReturnInt AS RETURN 42;");
var res2 = db.Procedures.sp_Exp_ReturnInt();
db.Execute(@"CREATE OR ALTER PROCEDURE sp_Exp_SomeData AS
SELECT 1 Id, 'Some Name 1' [Name], 'Some Desc 1' [Desc], GETDATE() [Date]
UNION ALL SELECT 2 Id, 'Some Name 2', 'Some Desc 2', GETDATE() [Date];");
var res3 = db.Procedures.sp_Exp_SomeData<sp_Exp_SomeData_Result>();
var res4 = db.Procedures.sp_Exp_SomeData<List<sp_Exp_SomeData_Result>>();
db.Execute(@"CREATE OR ALTER PROCEDURE sp_Exp_SomeInputAndOutput
@Name nvarchar(50),
@Result nvarchar(256) OUTPUT
AS
SELECT @Result = 'Hi, ' + @Name + ' your lucky number is 42!';");
var res5 = db.Procedures.sp_Exp_SomeInputAndOutput<string, sp_Exp_SomeInputAndOutput_Result>(Name: "G4g4r1n", out_Result: new DynamicColumn
{
Schema = new DynamicSchemaColumn
{
Size = 256,
},
}, ret_Return: 0);
var res6 = db.Procedures.sp_Exp_SomeInputAndOutput<string, sp_Exp_SomeInputAndOutput_Result>(Name: "G4g4r1n", out_Result: new DynamicSchemaColumn
{
Size = 256,
}, ret_Return: 0);
db.Execute(@"CREATE OR ALTER PROCEDURE sp_Exp_SomeInputAndOutputWithDataAndReturn
@Name nvarchar(50),
@Result nvarchar(256) OUTPUT
AS
SELECT @Result = 'Hi, ' + @Name + ' your lucky number is 42!'
SELECT 1 Id, 'Some Name 1' [Name], 'Some Desc 1' [Desc], GETDATE() [Date]
UNION ALL SELECT 2 Id, 'Some Name 2', 'Some Desc 2', GETDATE() [Date]
RETURN 42;");
var res7 = db.Procedures.sp_Exp_SomeInputAndOutputWithDataAndReturn<List<sp_Exp_SomeInputAndOutputWithDataAndReturn_Result.Data>, sp_Exp_SomeInputAndOutputWithDataAndReturn_Result>(Name: "G4g4r1n", out_Result: new DynamicColumn
{
Schema = new DynamicSchemaColumn
{
Size = 256,
},
}, ret_Return: 0);
var res8 = db.Procedures.sp_Exp_SomeInputAndOutputWithDataAndReturn<List<sp_Exp_SomeInputAndOutputWithDataAndReturn_Result.Data>, sp_Exp_SomeInputAndOutputWithDataAndReturn_Result>(Name: "G4g4r1n", out_Result: new DynamicSchemaColumn
{
Size = 256,
}, ret_Return: 0);
}
private class sp_Exp_SomeData_Result
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Desc { get; set; }
public virtual DateTime Date { get; set; }
}
private class sp_Exp_SomeInputAndOutput_Result
{
public virtual string Result { get; set; }
public virtual string Return { get; set; }
}
private class sp_Exp_SomeInputAndOutputWithDataAndReturn_Result
{
public class Data
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string Desc { get; set; }
public virtual DateTime Date { get; set; }
}
public virtual List<Data> sp_Exp_SomeInputAndOutputWithDataAndReturn { get; set; }
public virtual string Result { get; set; }
public virtual string Return { get; set; }
}
}
}

View File

@@ -1,448 +0,0 @@
using DynamORM;
using DynamORM.Mapper;
using DynamORM.Objects;
using System;
using System.Collections.Generic;
using System.Text;
namespace Tester.RealTests
{
internal static class OddNullabeleProblem
{
public static void Test(DynamicDatabase db)
{
var ca = new mom_Contractors_Articles();
ca.mca_min_date_valid_out = 5;
ca.mca_mar_code = "342";
ca.mca_mar_name = "234";
ca.SetDynamicEntityState(DynamicEntityState.Existing);
ca.mca_min_date_valid_out = null;
ca.mca_mar_code = null;
ca.mca_mar_name = null;
var r = new DynamicRepositoryBase<mom_Contractors_Articles>(db);
r.Save(ca);
}
[Table(Name = "mom_Contractors_Articles")]
public class mom_Contractors_Articles : DynamicEntityBase
{
private System.Guid _mca_id;
[Column("mca_id", true, AllowNull = false)]
public virtual System.Guid mca_id
{
get { return _mca_id; }
set
{
if (_mca_id != value)
{
this.OnPropertyChanging("mca_id", _mca_id, value);
_mca_id = value;
}
}
}
private System.Nullable<System.Guid> _mca_mc_id;
[Column("mca_mc_id")]
public virtual System.Nullable<System.Guid> mca_mc_id
{
get { return _mca_mc_id; }
set
{
if (_mca_mc_id != value)
{
this.OnPropertyChanging("mca_mc_id", _mca_mc_id, value);
_mca_mc_id = value;
}
}
}
private System.Nullable<System.Guid> _mca_mar_id;
[Column("mca_mar_id")]
public virtual System.Nullable<System.Guid> mca_mar_id
{
get { return _mca_mar_id; }
set
{
if (_mca_mar_id != value)
{
this.OnPropertyChanging("mca_mar_id", _mca_mar_id, value);
_mca_mar_id = value;
}
}
}
private System.Nullable<System.Int32> _mca_min_date_valid_out;
[Column("mca_min_date_valid_out", AllowNull = true)]
public virtual System.Nullable<System.Int32> mca_min_date_valid_out
{
get { return _mca_min_date_valid_out; }
set
{
if (_mca_min_date_valid_out != value)
{
this.OnPropertyChanging("mca_min_date_valid_out", _mca_min_date_valid_out, value);
_mca_min_date_valid_out = value;
}
}
}
private System.Nullable<System.Int32> _mca_min_date_valid_in;
[Column("mca_min_date_valid_in")]
public virtual System.Nullable<System.Int32> mca_min_date_valid_in
{
get { return _mca_min_date_valid_in; }
set
{
if (_mca_min_date_valid_in != value)
{
this.OnPropertyChanging("mca_min_date_valid_in", _mca_min_date_valid_in, value);
_mca_min_date_valid_in = value;
}
}
}
private System.String _mca_mar_code;
[Column("mca_mar_code", AllowNull = true)]
public virtual System.String mca_mar_code
{
get { return _mca_mar_code; }
set
{
if (_mca_mar_code != value)
{
this.OnPropertyChanging("mca_mar_code", _mca_mar_code, value);
_mca_mar_code = value;
}
}
}
private System.String _mca_mar_name;
[Column("mca_mar_name", AllowNull = true)]
public virtual System.String mca_mar_name
{
get { return _mca_mar_name; }
set
{
if (_mca_mar_name != value)
{
this.OnPropertyChanging("mca_mar_name", _mca_mar_name, value);
_mca_mar_name = value;
}
}
}
private System.String _mca_gid;
[Column("mca_GID")]
public virtual System.String mca_GID
{
get { return _mca_gid; }
set
{
if (_mca_gid != value)
{
this.OnPropertyChanging("mca_GID", _mca_gid, value);
_mca_gid = value;
}
}
}
private System.Nullable<System.Decimal> _mca_percent_wz;
[Column("mca_percent_WZ")]
public virtual System.Nullable<System.Decimal> mca_percent_WZ
{
get { return _mca_percent_wz; }
set
{
if (_mca_percent_wz != value)
{
this.OnPropertyChanging("mca_percent_WZ", _mca_percent_wz, value);
_mca_percent_wz = value;
}
}
}
private System.Nullable<System.Decimal> _mca_percent_pz;
[Column("mca_percent_PZ")]
public virtual System.Nullable<System.Decimal> mca_percent_PZ
{
get { return _mca_percent_pz; }
set
{
if (_mca_percent_pz != value)
{
this.OnPropertyChanging("mca_percent_PZ", _mca_percent_pz, value);
_mca_percent_pz = value;
}
}
}
private System.Byte _mca_tss_ignore;
[Column("mca_tss_ignore", AllowNull = false)]
public virtual System.Byte mca_tss_ignore
{
get { return _mca_tss_ignore; }
set
{
if (_mca_tss_ignore != value)
{
this.OnPropertyChanging("mca_tss_ignore", _mca_tss_ignore, value);
_mca_tss_ignore = value;
}
}
}
private System.String _mca_mar_bar_code;
[Column("mca_mar_bar_code")]
public virtual System.String mca_mar_bar_code
{
get { return _mca_mar_bar_code; }
set
{
if (_mca_mar_bar_code != value)
{
this.OnPropertyChanging("mca_mar_bar_code", _mca_mar_bar_code, value);
_mca_mar_bar_code = value;
}
}
}
private System.Nullable<System.Guid> _mca_mus_id_modified;
[Column("mca_mus_id_modified")]
public virtual System.Nullable<System.Guid> mca_mus_id_modified
{
get { return _mca_mus_id_modified; }
set
{
if (_mca_mus_id_modified != value)
{
this.OnPropertyChanging("mca_mus_id_modified", _mca_mus_id_modified, value);
_mca_mus_id_modified = value;
}
}
}
private System.Nullable<System.DateTime> _mca_date_modified;
[Column("mca_date_modified")]
public virtual System.Nullable<System.DateTime> mca_date_modified
{
get { return _mca_date_modified; }
set
{
if (_mca_date_modified != value)
{
this.OnPropertyChanging("mca_date_modified", _mca_date_modified, value);
_mca_date_modified = value;
}
}
}
private System.String _mca_ean_label_unit;
[Column("mca_ean_label_unit")]
public virtual System.String mca_ean_label_unit
{
get { return _mca_ean_label_unit; }
set
{
if (_mca_ean_label_unit != value)
{
this.OnPropertyChanging("mca_ean_label_unit", _mca_ean_label_unit, value);
_mca_ean_label_unit = value;
}
}
}
private System.String _mca_ean_label_pckg;
[Column("mca_ean_label_pckg")]
public virtual System.String mca_ean_label_pckg
{
get { return _mca_ean_label_pckg; }
set
{
if (_mca_ean_label_pckg != value)
{
this.OnPropertyChanging("mca_ean_label_pckg", _mca_ean_label_pckg, value);
_mca_ean_label_pckg = value;
}
}
}
private System.Nullable<System.Decimal> _mca_price;
[Column("mca_price")]
public virtual System.Nullable<System.Decimal> mca_price
{
get { return _mca_price; }
set
{
if (_mca_price != value)
{
this.OnPropertyChanging("mca_price", _mca_price, value);
_mca_price = value;
}
}
}
private System.String _mca_currency_code;
[Column("mca_currency_code")]
public virtual System.String mca_currency_code
{
get { return _mca_currency_code; }
set
{
if (_mca_currency_code != value)
{
this.OnPropertyChanging("mca_currency_code", _mca_currency_code, value);
_mca_currency_code = value;
}
}
}
private System.Nullable<System.Int32> _mca_time_ahead;
[Column("mca_time_ahead")]
public virtual System.Nullable<System.Int32> mca_time_ahead
{
get { return _mca_time_ahead; }
set
{
if (_mca_time_ahead != value)
{
this.OnPropertyChanging("mca_time_ahead", _mca_time_ahead, value);
_mca_time_ahead = value;
}
}
}
private System.Nullable<System.Decimal> _mca_last_price;
[Column("mca_last_price")]
public virtual System.Nullable<System.Decimal> mca_last_price
{
get { return _mca_last_price; }
set
{
if (_mca_last_price != value)
{
this.OnPropertyChanging("mca_last_price", _mca_last_price, value);
_mca_last_price = value;
}
}
}
private System.Nullable<System.Decimal> _mca_logistic_minimum_value;
[Column("mca_logistic_minimum_value")]
public virtual System.Nullable<System.Decimal> mca_logistic_minimum_value
{
get { return _mca_logistic_minimum_value; }
set
{
if (_mca_logistic_minimum_value != value)
{
this.OnPropertyChanging("mca_logistic_minimum_value", _mca_logistic_minimum_value, value);
_mca_logistic_minimum_value = value;
}
}
}
private System.Nullable<System.Decimal> _mca_logistic_minimum_mplt;
[Column("mca_logistic_minimum_mplt")]
public virtual System.Nullable<System.Decimal> mca_logistic_minimum_mplt
{
get { return _mca_logistic_minimum_mplt; }
set
{
if (_mca_logistic_minimum_mplt != value)
{
this.OnPropertyChanging("mca_logistic_minimum_mplt", _mca_logistic_minimum_mplt, value);
_mca_logistic_minimum_mplt = value;
}
}
}
private System.Nullable<System.Decimal> _mca_logistic_minimum_qty;
[Column("mca_logistic_minimum_qty")]
public virtual System.Nullable<System.Decimal> mca_logistic_minimum_qty
{
get { return _mca_logistic_minimum_qty; }
set
{
if (_mca_logistic_minimum_qty != value)
{
this.OnPropertyChanging("mca_logistic_minimum_qty", _mca_logistic_minimum_qty, value);
_mca_logistic_minimum_qty = value;
}
}
}
private System.Nullable<System.Decimal> _mca_req_kj_percent;
[Column("mca_req_kj_percent")]
public virtual System.Nullable<System.Decimal> mca_req_kj_percent
{
get { return _mca_req_kj_percent; }
set
{
if (_mca_req_kj_percent != value)
{
this.OnPropertyChanging("mca_req_kj_percent", _mca_req_kj_percent, value);
_mca_req_kj_percent = value;
}
}
}
private System.Nullable<System.Decimal> _mca_min_order_qty;
[Column("mca_min_order_qty")]
public virtual System.Nullable<System.Decimal> mca_min_order_qty
{
get { return _mca_min_order_qty; }
set
{
if (_mca_min_order_qty != value)
{
this.OnPropertyChanging("mca_min_order_qty", _mca_min_order_qty, value);
_mca_min_order_qty = value;
}
}
}
private System.Byte _mca_default_contractor;
[Column("mca_default_contractor", AllowNull = false)]
public virtual System.Byte mca_default_contractor
{
get { return _mca_default_contractor; }
set
{
if (_mca_default_contractor != value)
{
this.OnPropertyChanging("mca_default_contractor", _mca_default_contractor, value);
_mca_default_contractor = value;
}
}
}
}
}
}

View File

@@ -1,32 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Copyright>Copyright © RUSSEK Software 2012-2022</Copyright>
<Company>RUSSEK Software</Company>
<Authors>Grzegorz Russek</Authors>
<VersionPrefix>1.2.1</VersionPrefix>
<RepositoryUrl>https://svn.dr4cul4.pl/svn/DynamORM/</RepositoryUrl>
<PackageProjectUrl>https://dr4cul4.pl</PackageProjectUrl>
<Product>DynamORM</Product>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DynamORM\DynamORM.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>

18
scripts/docker/build.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
IMAGE="${DOTNET_IMAGE:-mcr.microsoft.com/dotnet/sdk:10.0}"
docker run --rm \
-v "${ROOT_DIR}:/workspace" \
-w /workspace \
"${IMAGE}" \
bash -lc "
set -euo pipefail
dotnet --info
dotnet restore DynamORM.sln
dotnet build DynamORM.sln -c Release --no-restore
dotnet pack DynamORM/DynamORM.csproj -c Release --no-build -o /workspace/artifacts/nuget
"

11
scripts/docker/ci-local.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
"${ROOT_DIR}/scripts/docker/generate-amalgamation.sh"
"${ROOT_DIR}/scripts/docker/build.sh"
"${ROOT_DIR}/scripts/docker/test.sh"
"${ROOT_DIR}/scripts/docker/mono-net40-smoke.sh"
echo "All docker checks completed."

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
IMAGE="${DOTNET_IMAGE:-mcr.microsoft.com/dotnet/sdk:10.0}"
docker run --rm \
-v "${ROOT_DIR}:/workspace" \
-w /workspace \
"${IMAGE}" \
bash -lc "
set -euo pipefail
dotnet run --project AmalgamationTool/AmalgamationTool.csproj -- DynamORM AmalgamationTool/DynamORM.Amalgamation.cs
"

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
IMAGE="${MONO_IMAGE:-mono:6.12}"
docker run --rm \
-v "${ROOT_DIR}:/workspace" \
-w /workspace \
"${IMAGE}" \
bash -lc "
set -euo pipefail
mono --version
mcs -langversion:latest -target:library -sdk:4 \
-r:System \
-r:System.Core \
-r:System.Data \
-r:Microsoft.CSharp \
-out:/tmp/DynamORM.Net40.Smoke.dll \
AmalgamationTool/DynamORM.Amalgamation.cs
ls -lh /tmp/DynamORM.Net40.Smoke.dll
"

15
scripts/docker/test.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
IMAGE="${DOTNET_IMAGE:-mcr.microsoft.com/dotnet/sdk:10.0}"
docker run --rm \
-v "${ROOT_DIR}:/workspace" \
-w /workspace \
"${IMAGE}" \
bash -lc "
set -euo pipefail
dotnet test DynamORM.Tests/DynamORM.Tests.csproj -c Release
"