Skip to content

Commit 8f7540c

Browse files
LINQ 2 SQL compatibility (#293)
1 parent 71176b5 commit 8f7540c

14 files changed

+650
-9
lines changed

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ test_script:
5151
-targetargs:"
5252
net\DevExtreme.AspNet.Data.Tests.NET4\bin\Debug\DevExtreme.AspNet.Data.Tests.dll
5353
net\DevExtreme.AspNet.Data.Tests.EF6\bin\Debug\DevExtreme.AspNet.Data.Tests.EF6.dll
54+
net\DevExtreme.AspNet.Data.Tests.L2S\bin\Debug\DevExtreme.AspNet.Data.Tests.L2S.dll
5455
-noshadow"
5556
-filter:"+[DevExtreme*]* -[DevExtreme.AspNet.Data.Tests]* -[DevExtreme.AspNet.Data.Tests.*]*"
5657
-output:coverage_netfx.xml
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" />
4+
<Import Project="..\packages\xunit.core.2.3.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.3.1\build\xunit.core.props')" />
5+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
6+
<PropertyGroup>
7+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9+
<ProjectGuid>{190E01CD-78FC-4578-ACBF-7D6C4DC57C18}</ProjectGuid>
10+
<OutputType>Library</OutputType>
11+
<AppDesignerFolder>Properties</AppDesignerFolder>
12+
<RootNamespace>DevExtreme.AspNet.Data.Tests.L2S</RootNamespace>
13+
<AssemblyName>DevExtreme.AspNet.Data.Tests.L2S</AssemblyName>
14+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
15+
<FileAlignment>512</FileAlignment>
16+
<Deterministic>true</Deterministic>
17+
<NuGetPackageImportStamp>
18+
</NuGetPackageImportStamp>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
<Reference Include="System.Core" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Data.Linq" />
42+
<Reference Include="System.Data.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
43+
<HintPath>..\packages\System.Data.Common.4.1.0\lib\net451\System.Data.Common.dll</HintPath>
44+
</Reference>
45+
<Reference Include="System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
46+
<HintPath>..\packages\System.Data.SqlClient.4.1.0\lib\net46\System.Data.SqlClient.dll</HintPath>
47+
</Reference>
48+
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
49+
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
50+
</Reference>
51+
<Reference Include="xunit.assert, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
52+
<HintPath>..\packages\xunit.assert.2.3.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
53+
</Reference>
54+
<Reference Include="xunit.core, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
55+
<HintPath>..\packages\xunit.extensibility.core.2.3.1\lib\netstandard1.1\xunit.core.dll</HintPath>
56+
</Reference>
57+
<Reference Include="xunit.execution.desktop, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
58+
<HintPath>..\packages\xunit.extensibility.execution.2.3.1\lib\net452\xunit.execution.desktop.dll</HintPath>
59+
</Reference>
60+
</ItemGroup>
61+
<ItemGroup>
62+
<ProjectReference Include="..\DevExtreme.AspNet.Data.Tests.Common\DevExtreme.AspNet.Data.Tests.Common.csproj">
63+
<Project>{f5878ad6-459f-4fce-9bfb-54ee94d2083f}</Project>
64+
<Name>DevExtreme.AspNet.Data.Tests.Common</Name>
65+
</ProjectReference>
66+
<ProjectReference Include="..\DevExtreme.AspNet.Data\DevExtreme.AspNet.Data.csproj">
67+
<Project>{f91204f2-1f3a-433f-871d-5f31b769fa90}</Project>
68+
<Name>DevExtreme.AspNet.Data</Name>
69+
</ProjectReference>
70+
</ItemGroup>
71+
<ItemGroup>
72+
<None Include="packages.config" />
73+
<None Include="TestDataClasses.dbml">
74+
<Generator>MSLinqToSQLGenerator</Generator>
75+
<LastGenOutput>TestDataClasses.designer.cs</LastGenOutput>
76+
<SubType>Designer</SubType>
77+
</None>
78+
<None Include="TestDataClasses.dbml.layout">
79+
<DependentUpon>TestDataClasses.dbml</DependentUpon>
80+
</None>
81+
</ItemGroup>
82+
<ItemGroup>
83+
<Analyzer Include="..\packages\xunit.analyzers.0.7.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
84+
</ItemGroup>
85+
<ItemGroup>
86+
<Folder Include="Properties\" />
87+
</ItemGroup>
88+
<ItemGroup>
89+
<Compile Include="RemoteGroupingStress.cs" />
90+
<Compile Include="Summary.cs" />
91+
<Compile Include="TestDataClasses.cs">
92+
<DependentUpon>TestDataClasses.dbml</DependentUpon>
93+
</Compile>
94+
<Compile Include="TestDataClasses.designer.cs">
95+
<AutoGen>True</AutoGen>
96+
<DesignTime>True</DesignTime>
97+
<DependentUpon>TestDataClasses.dbml</DependentUpon>
98+
</Compile>
99+
</ItemGroup>
100+
<ItemGroup>
101+
<Service Include="{3259AA49-8AA1-44D3-9025-A0B520596A8C}" />
102+
</ItemGroup>
103+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
104+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
105+
<PropertyGroup>
106+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
107+
</PropertyGroup>
108+
<Error Condition="!Exists('..\packages\xunit.core.2.3.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.3.1\build\xunit.core.props'))" />
109+
<Error Condition="!Exists('..\packages\xunit.core.2.3.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.3.1\build\xunit.core.targets'))" />
110+
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props'))" />
111+
</Target>
112+
<Import Project="..\packages\xunit.core.2.3.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.3.1\build\xunit.core.targets')" />
113+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Linq;
3+
using Xunit;
4+
5+
namespace DevExtreme.AspNet.Data.Tests.L2S {
6+
using DataItem = RemoteGroupingStress_DataItem;
7+
8+
public class RemoteGroupingStress {
9+
10+
[Fact]
11+
public void Scenario() {
12+
TestDataContext.Exec(context => {
13+
var table = context.RemoteGroupingStress_DataItems;
14+
15+
table.InsertOnSubmit(new DataItem());
16+
context.SubmitChanges();
17+
18+
RemoteGroupingStressHelper.Run(table);
19+
});
20+
}
21+
22+
}
23+
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Linq;
3+
using Xunit;
4+
5+
namespace DevExtreme.AspNet.Data.Tests.L2S {
6+
using DataItem = Summary_DataItem;
7+
8+
public class Summary {
9+
10+
[Fact]
11+
public void Scenario() {
12+
TestDataContext.Exec(context => {
13+
var table = context.Summary_DataItems;
14+
15+
table.InsertAllOnSubmit(SummaryTestHelper.GenerateTestData(() => new DataItem()));
16+
context.SubmitChanges();
17+
18+
SummaryTestHelper.Run(table);
19+
});
20+
}
21+
22+
}
23+
24+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
using System.Linq;
3+
4+
namespace DevExtreme.AspNet.Data.Tests.L2S {
5+
6+
partial class TestDataContext {
7+
static readonly object LOCK = new object();
8+
static TestDataContext INSTANCE;
9+
10+
public static void Exec(Action<TestDataContext> action) {
11+
lock(LOCK) {
12+
if(INSTANCE == null) {
13+
var helper = new SqlServerTestDbHelper("L2S");
14+
helper.ResetDatabase();
15+
16+
INSTANCE = new TestDataContext(helper.ConnectionString);
17+
18+
INSTANCE.ExecuteCommand(
19+
$@"create table {nameof(RemoteGroupingStress_DataItem)} (
20+
{nameof(RemoteGroupingStress_DataItem.ID)} int identity primary key,
21+
{nameof(RemoteGroupingStress_DataItem.Num)} int not null,
22+
{nameof(RemoteGroupingStress_DataItem.NullNum)} int,
23+
{nameof(RemoteGroupingStress_DataItem.Date)} datetime2 not null,
24+
{nameof(RemoteGroupingStress_DataItem.NullDate)} datetime2
25+
)"
26+
);
27+
28+
INSTANCE.ExecuteCommand(
29+
$@"create table {nameof(Summary_DataItem)} (
30+
{nameof(Summary_DataItem.ID)} int identity primary key,
31+
{nameof(Summary_DataItem.Group1)} nvarchar,
32+
{nameof(Summary_DataItem.Group2)} nvarchar,
33+
{nameof(Summary_DataItem.Value)} int
34+
)"
35+
);
36+
}
37+
38+
action(INSTANCE);
39+
}
40+
}
41+
42+
}
43+
44+
partial class RemoteGroupingStress_DataItem : RemoteGroupingStressHelper.IEntity {
45+
}
46+
47+
partial class Summary_DataItem : SummaryTestHelper.IEntity {
48+
}
49+
50+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?><Database Class="TestDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
2+
<Table Name="" Member="RemoteGroupingStress_DataItems">
3+
<Type Name="RemoteGroupingStress_DataItem">
4+
<Column Name="ID" AutoSync="Never" Type="System.Int32" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
5+
<Column Name="Num" Type="System.Int32" CanBeNull="false" />
6+
<Column Name="NullNum" Type="System.Int32" CanBeNull="true" />
7+
<Column Name="Date" Type="System.DateTime" DbType="datetime2" CanBeNull="false" />
8+
<Column Name="NullDate" Type="System.DateTime" DbType="datetime2" CanBeNull="true" />
9+
</Type>
10+
</Table>
11+
<Table Name="" Member="Summary_DataItems">
12+
<Type Name="Summary_DataItem">
13+
<Column Name="ID" AutoSync="Never" Type="System.Int32" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
14+
<Column Name="Group1" Type="System.String" CanBeNull="true" />
15+
<Column Name="Group2" Type="System.String" CanBeNull="true" />
16+
<Column Name="Value" Type="System.Int32" CanBeNull="true" />
17+
</Type>
18+
</Table>
19+
</Database>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 11, 8.5" name="TestDataClasses">
3+
<DataContextMoniker Name="/TestDataContext" />
4+
<nestedChildShapes>
5+
<classShape Id="1332ebe5-4f49-4902-b0bd-cc3473f4ad2e" absoluteBounds="0.5, 0.5, 2.375, 1.7708968098958331">
6+
<DataClassMoniker Name="/TestDataContext/RemoteGroupingStress_DataItem" />
7+
<nestedChildShapes>
8+
<elementListCompartment Id="89a38af0-4682-4c9a-9d46-c80b4ed776f5" absoluteBounds="0.515, 0.96, 2.3449999999999998, 1.2108968098958333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
9+
</nestedChildShapes>
10+
</classShape>
11+
<classShape Id="87e63c9e-1134-4abf-97e2-94de8d6b14d1" absoluteBounds="3.375, 0.5, 2, 1.5785953776041666">
12+
<DataClassMoniker Name="/TestDataContext/Summary_DataItem" />
13+
<nestedChildShapes>
14+
<elementListCompartment Id="672e9425-153a-4b0e-a766-7a2ce04a4891" absoluteBounds="3.39, 0.96, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
15+
</nestedChildShapes>
16+
</classShape>
17+
</nestedChildShapes>
18+
</ordesignerObjectsDiagram>

0 commit comments

Comments
 (0)