Skip to content

Commit 4efec2b

Browse files
committed
Merge branch 'master' into test-localization-projectiontocustomtypes
2 parents 9ed7753 + bcd087d commit 4efec2b

File tree

228 files changed

+26383
-2948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+26383
-2948
lines changed

ChangeLog/6.0.4_Z_Final.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@
33
[main] Domain.OpenSessionAsync() methods can only open a session to default storage node now
44
[main] Introduced StorageNode.OpenSession() and StorageNode.OpenSessionAsync() method sets to open sessions to the node
55
[main] Fixed issue when DirectPersistentAccessor.SetReferenceKey() was unable to set reference for saved Entities
6+
[main] Hints which path became irrelevant during upgrade actions generation no longer cause error
7+
[main] Fixed certain translation issues of interface members usage for non-perstent types initialization within queries
8+
[main] Improved translation of certain subqueries used in LINQ
9+
[main] Ported changes of DO 5.0 which were missing (from 5.0.18 up to 5.0.21)
10+
[postgresql] Retuned support for DateTimeOffsets
11+
[postgresql] Fixed issue when certain DateTimeOffsets operations result couldn't be used for parts extraction e.g. TotalMilliseconds
12+
[bulkoperations] Addressed wrong table alias assignment issue for Bulk Update and Bulk Delete

Directory.Build.props

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,43 @@
55

66
<!-- Compute intermediate values. To avoid conflicts name all custom variables with Do prefix. -->
77
<PropertyGroup>
8-
<DoBuildNumber>$(BUILD_NUMBER)</DoBuildNumber>
9-
<DoBuildNumber Condition="'$(DoBuildNumber)'==''">0</DoBuildNumber>
108
<DoBuildYear>$([System.DateTime]::Today.Year)</DoBuildYear>
119
<DoProductName>DataObjects.Net</DoProductName>
1210
<DoProductAuthors>Xtensive LLC and contributors</DoProductAuthors>
1311
<DoProductCopyright>2003-$(DoBuildYear) $(DoProductAuthors)</DoProductCopyright>
14-
<DoVersionSuffix Condition="'$(DoVersionSuffix)'=='dev'">dev-$(DoBuildNumber)</DoVersionSuffix>
12+
1513
<DoMajor>$([System.Version]::new($(DoVersion)).Major)</DoMajor>
1614
<DoMinor>$([System.Version]::new($(DoVersion)).Minor)</DoMinor>
17-
<DoPatch>$([System.Version]::new($(DoVersion)).Build)</DoPatch>
18-
<DoVersionName>$(DoMajor).$(DoMinor).$(DoPatch)</DoVersionName>
19-
<DoVersionName Condition="'$(DoVersionSuffix)'!=''">$(DoVersionName)-$(DoVersionSuffix)</DoVersionName>
15+
<DoBuild>$([System.Version]::new($(DoVersion)).Build)</DoBuild>
16+
<DoRevision>$([System.Version]::new($(DoVersion)).Revision)</DoRevision>
17+
18+
<DoFileRevision>$(BUILD_NUMBER)</DoFileRevision>
19+
<DoFileRevision Condition="'$(DoFileRevision)' == '' AND '$(DoRevision)' != '-1'">$(DoRevision)</DoFileRevision>
20+
<DoFileRevision Condition="'$(DoFileRevision)' == ''">0</DoFileRevision>
21+
22+
<DoVersionSuffix Condition="'$(DoVersionSuffix)' == 'dev'">dev-$(DoFileRevision)</DoVersionSuffix>
23+
24+
<DoVersionName>$(DoMajor).$(DoMinor).$(DoBuild)</DoVersionName>
25+
<DoVersionName Condition="'$(DoRevision)' != '-1'">$(DoVersionName).$(DoRevision)</DoVersionName>
26+
<DoVersionName Condition="'$(DoVersionSuffix)' != ''">$(DoVersionName)-$(DoVersionSuffix)</DoVersionName>
27+
2028
<DoPackageIcon>$(MSBuildThisFileDirectory)do-nuget.png</DoPackageIcon>
29+
30+
<DoGeneratePackage>true</DoGeneratePackage>
31+
<DoGeneratePackage Condition="$(MSBuildProjectName) == 'Xtensive.Orm.Weaver'">false</DoGeneratePackage>
32+
<DoGeneratePackage Condition="$(MSBuildProjectName) == 'Xtensive.Orm.Manual'">false</DoGeneratePackage>
33+
<DoGeneratePackage Condition="$(MSBuildProjectName) == 'TestCommon'">false</DoGeneratePackage>
34+
<DoGeneratePackage Condition="$(MSBuildProjectName.Contains('Tests')) == 'true'">false</DoGeneratePackage>
2135
</PropertyGroup>
2236

2337
<PropertyGroup>
38+
<NoLogo>true</NoLogo>
39+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
2440
<TargetFramework>netcoreapp3.1</TargetFramework>
2541
<SolutionDir Condition="$(SolutionDir) == ''">$([MSBuild]::EnsureTrailingSlash(
2642
$([MSBuild]::GetDirectoryNameOfFileAbove('$(MSBuildThisFileDirectory)', 'Orm.sln'))))</SolutionDir>
2743
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
28-
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
29-
<NoLogo>true</NoLogo>
30-
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
31-
<ArtifactsDir Condition="'$(ArtifactsDir)'==''">$(SolutionDir)_Build\</ArtifactsDir>
44+
<ArtifactsDir Condition="'$(ArtifactsDir)' == ''">$(SolutionDir)_Build\</ArtifactsDir>
3245
<BaseIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(ArtifactsDir)obj\$(Configuration)\$(MSBuildProjectName)'))\</BaseIntermediateOutputPath>
3346
<BaseOutputPath >$([System.IO.Path]::GetFullPath('$(ArtifactsDir)bin\$(Configuration)'))\</BaseOutputPath>
3447
<BaseOutputPath Condition="$(MSBuildProjectName.Contains('Tests'))">$([System.IO.Path]::GetFullPath('$(ArtifactsDir)tests'))\</BaseOutputPath>
@@ -39,33 +52,14 @@
3952
<OrmKeyFile>$(SolutionDir)Orm\Orm.snk</OrmKeyFile>
4053
</PropertyGroup>
4154

42-
<PropertyGroup>
43-
<GeneratePackageOnBuild Condition="$(MSBuildProjectName) == 'Xtensive.Orm.Weaver'">false</GeneratePackageOnBuild>
44-
<GeneratePackageOnBuild Condition="$(MSBuildProjectName) == 'Xtensive.Orm.Manual'">false</GeneratePackageOnBuild>
45-
<GeneratePackageOnBuild Condition="$(MSBuildProjectName) == 'TestCommon'">false</GeneratePackageOnBuild>
46-
<GeneratePackageOnBuild Condition="$(MSBuildProjectName.Contains('Tests')) == 'true'">false</GeneratePackageOnBuild>
47-
<GeneratePackageOnBuild Condition="$(GeneratePackageOnBuild)=='' AND '$(Configuration)' == 'Release'">true</GeneratePackageOnBuild>
48-
49-
<IncludeSymbols Condition="$(GeneratePackageOnBuild) == 'true'">true</IncludeSymbols>
50-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
51-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
52-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
53-
</PropertyGroup>
54-
55-
<ItemGroup>
56-
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
57-
<PackageReference Condition="$(GeneratePackageOnBuild) == 'true'"
58-
Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
59-
</ItemGroup>
60-
6155
<!-- Populate standard properties. -->
6256
<PropertyGroup>
6357
<Product>$(DoProductName)</Product>
6458
<Company>$(DoProductAuthors)</Company>
6559
<Authors>$(DoProductAuthors)</Authors>
6660
<Version>$(DoVersionName)</Version>
6761
<AssemblyVersion>$(DoMajor).$(DoMinor).0.0</AssemblyVersion>
68-
<FileVersion>$(DoMajor).$(DoMinor).$(DoPatch).$(DoBuildNumber)</FileVersion>
62+
<FileVersion>$(DoMajor).$(DoMinor).$(DoBuild).$(DoFileRevision)</FileVersion>
6963
<Copyright>$(DoProductCopyright)</Copyright>
7064
<PackageProjectUrl>https://dataobjects.net/</PackageProjectUrl>
7165
<PackageIcon>do-nuget.png</PackageIcon>
@@ -74,9 +68,19 @@
7468
<PackageOutputPath>$(MSBuildThisFileDirectory)_Build\$(Configuration)\packages\</PackageOutputPath>
7569
<RepositoryUrl>https://github.com/DataObjects-NET/dataobjects-net</RepositoryUrl>
7670
<RepositoryType>git</RepositoryType>
71+
72+
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
73+
<GeneratePackageOnBuild Condition="$(DoGeneratePackage) == 'true' AND '$(Configuration)' == 'Release'">true</GeneratePackageOnBuild>
74+
<IncludeSymbols Condition="$(GeneratePackageOnBuild) == 'true'">true</IncludeSymbols>
75+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
76+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
77+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
7778
</PropertyGroup>
7879

7980
<ItemGroup>
81+
<SourceRoot Include="$(SolutionDir)"/>
82+
<PackageReference Condition="$(DoGeneratePackage) == 'true'"
83+
Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
8084
<None Include="$(DoPackageIcon)" Visible="false" >
8185
<PackagePath>.</PackagePath>
8286
<Pack>true</Pack>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using NUnit.Framework;
6+
using TestCommon.Model;
7+
using Xtensive.Orm.BulkOperations.Tests.Issues.WrongAliassesIssue;
8+
using Xtensive.Sql;
9+
10+
namespace Xtensive.Orm.BulkOperations.Tests.Issues
11+
{
12+
public class JoinedTableAsSourceForOperationsCauseWrongAliases : AutoBuildTest
13+
{
14+
[Test]
15+
public void CustomerCase()
16+
{
17+
using (var session = Domain.OpenSession())
18+
using (var tx = session.OpenTransaction()) {
19+
var query = session.Query.All<DowntimeReason>()
20+
.Where(r => r.DowntimeInfo.Record.Equipment.Id == 333);
21+
22+
var queryResult = query.Delete();
23+
}
24+
}
25+
26+
[Test]
27+
public void MultipleKeyTest()
28+
{
29+
using (var session = Domain.OpenSession())
30+
using (var tx = session.OpenTransaction()) {
31+
var query = session.Query.All<DowntimeReason2>()
32+
.Where(r => r.DowntimeInfo.Record.Equipment.Id == 333);
33+
34+
var queryResult = query.Delete();
35+
}
36+
}
37+
}
38+
}
39+
40+
namespace Xtensive.Orm.BulkOperations.Tests.Issues.WrongAliassesIssue
41+
{
42+
[HierarchyRoot]
43+
public class DowntimeReason : Entity
44+
{
45+
[Field, Key]
46+
public int Id { get; private set; }
47+
48+
[Field]
49+
public DowntimeInfo DowntimeInfo { get; set; }
50+
}
51+
52+
[HierarchyRoot]
53+
[KeyGenerator(KeyGeneratorKind.None)]
54+
public class DowntimeReason2 : Entity
55+
{
56+
[Field, Key(0)]
57+
public int Id { get; private set; }
58+
59+
[Field, Key(1)]
60+
public int Id2 { get; private set; }
61+
62+
[Field]
63+
public DowntimeInfo DowntimeInfo { get; set; }
64+
}
65+
66+
[HierarchyRoot]
67+
public class DowntimeInfo : Entity
68+
{
69+
[Field, Key]
70+
public int Id { get; private set; }
71+
72+
[Field]
73+
public Record Record { get; set; }
74+
}
75+
76+
[HierarchyRoot]
77+
public class Record : Entity
78+
{
79+
[Field, Key]
80+
public int Id { get; private set; }
81+
82+
[Field]
83+
public Equipment Equipment { get; set; }
84+
}
85+
86+
[HierarchyRoot]
87+
public class Equipment : Entity
88+
{
89+
[Field, Key]
90+
public int Id { get; private set; }
91+
}
92+
}

Extensions/Xtensive.Orm.BulkOperations/Internals/Operation.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@ internal abstract class Operation<T>
2222
where T : class, IEntity
2323
{
2424
public readonly QueryProvider QueryProvider;
25+
public readonly QueryBuilder QueryBuilder;
2526
public List<QueryParameterBinding> Bindings;
27+
public SqlTableRef JoinedTableRef;
28+
2629
protected readonly DomainHandler DomainHandler;
2730
protected readonly PrimaryIndexMapping[] PrimaryIndexes;
28-
public readonly QueryBuilder QueryBuilder;
29-
public readonly Session Session;
3031
protected readonly TypeInfo TypeInfo;
31-
public SqlTableRef JoinedTableRef;
32+
33+
public Session Session { get { return QueryBuilder.Session; } }
3234

3335
public int Execute()
3436
{
3537
EnsureTransactionIsStarted();
36-
QueryProvider.Session.SaveChanges();
37-
var value = ExecuteInternal();
38+
Session.SaveChanges();
39+
int value = ExecuteInternal();
3840
DirectStateAccessor.Get(QueryProvider.Session).Invalidate();
3941
return value;
4042
}
@@ -77,15 +79,15 @@ protected Operation(QueryProvider queryProvider)
7779
{
7880
QueryProvider = queryProvider;
7981
var entityType = typeof (T);
80-
Session = queryProvider.Session;
81-
DomainHandler = Session.Domain.Services.Get<DomainHandler>();
82+
var session = queryProvider.Session;
83+
DomainHandler = session.Domain.Services.Get<DomainHandler>();
8284
TypeInfo = GetTypeInfo(entityType);
83-
var mapping = Session.StorageNode.Mapping;
85+
var mapping = session.StorageNode.Mapping;
8486
PrimaryIndexes = TypeInfo.AffectedIndexes
8587
.Where(i => i.IsPrimary)
8688
.Select(i => new PrimaryIndexMapping(i, mapping[i.ReflectedType]))
8789
.ToArray();
88-
QueryBuilder = Session.Services.Get<QueryBuilder>();
90+
QueryBuilder = session.Services.Get<QueryBuilder>();
8991
}
9092
}
9193
}

Extensions/Xtensive.Orm.BulkOperations/Internals/QueryOperation.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
// Copyright (C) 2019-2020 Xtensive LLC.
1+
// Copyright (C) 2019-2020 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44

55
using System;
66
using System.Collections.Generic;
77
using System.Linq;
88
using System.Linq.Expressions;
9+
using Xtensive.Core;
910
using Xtensive.Orm.Linq;
1011
using Xtensive.Orm.Model;
1112
using Xtensive.Sql;
@@ -121,7 +122,6 @@ private void JoinWhenQueryHasNoLimitation(SqlStatement statement, SqlSelect sele
121122
JoinedTableRef = sqlTableRef;
122123
return;
123124
}
124-
125125
if (SupportsJoin()) {
126126
JoinViaFrom(statement, select);
127127
}
@@ -138,14 +138,15 @@ private void JoinViaIn(SqlStatement statement, SqlSelect select)
138138
var indexMapping = PrimaryIndexes[0];
139139
var columns = new List<ColumnInfo>();
140140
foreach (var columnInfo in indexMapping.PrimaryIndex.KeyColumns.Keys) {
141-
var s = select.ShallowClone();
141+
var s = (SqlSelect) select.Clone();
142142
foreach (var column in columns) {
143-
var ex = SqlDml.Equals(SqlDml.TableColumn(s.From, column.Name), SqlDml.TableColumn(table, column.Name));
143+
var ex = SqlDml.Equals(s.From.Columns[column.Name], table.Columns[column.Name]);
144144
s.Where = s.Where.IsNullReference() ? ex : SqlDml.And(s.Where, ex);
145145
}
146-
146+
var existingColumns = s.Columns.ToChainedBuffer();
147147
s.Columns.Clear();
148-
s.Columns.Add(SqlDml.TableColumn(s.From, columnInfo.Name));
148+
var columnToAdd = existingColumns.First(c => c.Name.Equals(columnInfo.Name, StringComparison.Ordinal));
149+
s.Columns.Add(columnToAdd);
149150
var @in = SqlDml.In(SqlDml.TableColumn(table, columnInfo.Name), s);
150151
where = where.IsNullReference() ? @in : SqlDml.And(where, @in);
151152
columns.Add(columnInfo);
@@ -183,4 +184,4 @@ private void JoinViaFrom(SqlStatement statement, SqlSelect select)
183184

184185
#endregion
185186
}
186-
}
187+
}

Orm/Xtensive.Orm.Firebird/Sql.Drivers.Firebird/v2_5/ServerInfoProvider.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2011-2020 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Csaba Beer
55
// Created: 2011.01.10
66

@@ -179,6 +179,7 @@ public override QueryInfo GetQueryInfo()
179179
queryInfo.ParameterPrefix = "@";
180180
queryInfo.MaxLength = MaxCharLength;
181181
queryInfo.MaxComparisonOperations = DoNotKnow;
182+
queryInfo.MaxQueryParameterCount = DoNotKnow;
182183
queryInfo.Features =
183184
QueryFeatures.NamedParameters |
184185
QueryFeatures.ParameterPrefix |

Orm/Xtensive.Orm.Firebird/Xtensive.Orm.Firebird.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<IsPackable>true</IsPackable>
44
<OutputPath>$(SolutionDir)_Build\$(Configuration)\lib\</OutputPath>
@@ -21,5 +21,11 @@
2121
<ItemGroup>
2222
<ProjectReference Include="..\Xtensive.Orm\Xtensive.Orm.csproj" />
2323
</ItemGroup>
24-
24+
<ItemGroup>
25+
<Compile Update="Sql.Drivers.Firebird\Resources\Strings.Designer.cs">
26+
<DesignTime>True</DesignTime>
27+
<AutoGen>True</AutoGen>
28+
<DependentUpon>Strings.resx</DependentUpon>
29+
</Compile>
30+
</ItemGroup>
2531
</Project>

Orm/Xtensive.Orm.Manual/DomainAndSession/DomainAndSessionSample.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2009-2020 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alex Kofman
55
// Created: 2009.06.17
66

Orm/Xtensive.Orm.Manual/ModellingDomain/AuditAndOpenGenericsTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2009-2020 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alex Kofman
55
// Created: 2009.06.17
66

@@ -236,7 +236,7 @@ public void OnBuilt(Domain domain)
236236
Domain = domain;
237237
domain.SessionOpen += (source, args) => {
238238
args.Session.Events.TransactionOpened += TransactionOpened;
239-
args.Session.Events.TransactionCommitting += TransactionCommitting;
239+
args.Session.Events.TransactionPrecommitting += TransactionPrecommitting;
240240
args.Session.Events.EntityCreated += (sender, e) => EntityEvent(sender, e, true);
241241
args.Session.Events.EntityRemoveCompleted += (sender, e) => EntityEvent(sender, e, false);
242242
args.Session.Events.EntityFieldValueSetCompleted += (sender, e) => EntityEvent(sender, e, false);
@@ -257,7 +257,7 @@ private void TransactionOpened(object sender, TransactionEventArgs e)
257257
session.Extensions.Set(info);
258258
}
259259

260-
private void TransactionCommitting(object sender, TransactionEventArgs e)
260+
private void TransactionPrecommitting(object sender, TransactionEventArgs e)
261261
{
262262
var transaction = e.Transaction;
263263
if (transaction.IsNested)

0 commit comments

Comments
 (0)