Skip to content

Commit 4e27f5e

Browse files
authored
Merge branch 'master' into upstream/buildDomains
2 parents 47e8b98 + 7f9ccee commit 4e27f5e

153 files changed

Lines changed: 16451 additions & 8754 deletions

File tree

Some content is hidden

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

ChangeLog/6.0.10_Z_Final.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[main] Fixed certain cases of NRE happened on Domain build due to views in extracted schema
2+
[main] Fixed NotSupportedException appeared on x86 architecture when DateTimeOffset is used in entites
Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,42 @@
1-
[main] ThreadSafeCache is removed
1+
[main] ThreadSafeCache, ThreadSafeDictionary, ThreadSafeList collections are removed
22
[main] INamedValueCollection and its the only implementer NamedValueCollection are removed
33
[main] ICollectionChangeNotifier, CollectionChangeNotifierEventArgs are removed
4-
[main] ArrayUtils class is removed
5-
[main] ISet<T> interface is removed and all usages are replaced with .Net ISet<T>
6-
[main] Set<T>, SetSlim<T>, ReadOnlySet<T> collections and abstract SetBase are removed
7-
[main] ReadOnlyList<T> is removed
8-
[main] ReadOnlyCollection<T>
9-
[main] ReadOnlyDictionary<TKey, TValue> is removed
10-
[main] ThreadSafeDictionary is removed
11-
[main] ThreadSafeList struct is removed
12-
[main] TypeClassifier collection is removed
13-
[main] LazyDictionary is removed
14-
[main] FlagRegistry is removed
15-
[main] EnumerableUtils<T> is removed
16-
[main] DifferentialDictionary and DifferentialDictionaryDifference are removed
4+
[main] ArrayUtils and EnumerableUtils<T> are removed
5+
[main] ISet<T> interface is removed and all usages are replaced with System.Collections.Generic.ISet<T>
6+
[main] Set<T>, SetSlim<T>, ReadOnlySet<T> collections and abstract SetBase class are removed
7+
[main] ReadOnlyList<T>, ReadOnlyCollection<T>, ReadOnlyDictionary<TKey, TValue> collections are removed
8+
[main] ThreadSafeCached type is removed
9+
[main] Triplet<T> and Triplet<TFirst,TSecond,TThird> are removed
10+
[main] TypeClassifier, LazyDictionary and FlagRegistry collections are removed
11+
[main] DifferentialDictionary and DifferentialDictionaryDifference types are removed
1712
[main] CollectionBase<T> is removed
1813
[main] StringExtensions.Join() methods are removed
1914
[main] CollectionExtensions.ReverseList() method is removed
20-
[main] ThreadSafeCached type is removed
21-
[main] Triplet<T> and Triplet<TFirst,TSecond,TThird> are removed
15+
[main] SqlTranslator/SqlCompiler APIs were significantly changed in order to improve memory usage and perfromance
2216
[main] Introduced IQueryable<T>.Tag() extensions allowing to add tags to result SQL statement
2317
[main] Introduced Session.Tag() method for being able to tag queries within returned TagScope
24-
[main] Domain.TagsEnabled is introduced as faster alternative to DomainConfiguration.TagLocation!=TagLocation.Nowhere check
25-
[main] ReadOnlyHashSet<T> now implements .Net ISet and IReadOnlySet instead of removed ISet and IReadOnly
18+
[main] Domain.TagsEnabled is introduced as easier alternative to DomainConfiguration.TagLocation!=TagLocation.Nowhere check
2619
[main] NativeTypeClassifier collection now inherits ClassifiedCollection directly
27-
[main] FlagCollection.Keys return type has changed from removed ReadOnlyList<T> to .Net IReadOnlyList<T>
20+
[main] FlagCollection.Keys no returns .Net IReadOnlyList<TKey>
2821
[main] CollectionBaseSlim<T> no longer implements IList<T> and ICollection but implements ICollection<T> and IReadOnlyList<T>
2922
[main] AggregateException.Exceptions property changed its return type to IReadOnlyList<Exception>
3023
[main] AggregateException constuctors get array of exceptions instead of IEnumerable<Exception>
3124
[main] CopyDataHint.CopiedColumns property changed its return type to IReadOnlyList<Pair<string>>
32-
[main] DateHint.Identitites property changed its return type to IReadOnlyList<IdentityPair>
33-
[main] UpdateDataHint.UpdateParameter property changed its return type to IReadOnlyList<Pair<string, object>>
25+
[main] DateHint.Identitites property changed return type to IReadOnlyList<IdentityPair>
26+
[main] UpdateDataHint.UpdateParameter property changed return type to IReadOnlyList<Pair<string, object>>
3427
[main] IUpgrader methods now return IReadOnlyList<NodeAction>
35-
[main] PropertyAccessorDictionary has changed API due to change its base type and interfaces
28+
[main] PropertyAccessorDictionary has changed API due to change of the base type and interfaces
3629
[main] FullTextIndexDefCollection changed its base type to CollectionBaseSlim<FullTextIndexDef>
37-
[main] HierarchyDefCollection changed its base type to CollectionBaseSlim<HierarchyDef>
30+
[main] HierarchyDefCollection base type changed to CollectionBaseSlim<HierarchyDef>
3831
[main] HierarchyDefCollection and TypeDefCollection changed events set due to change of base type
3932
[main] SessionConfiguration collection API changed due to changes in base type CollectionBaseSlim<T>
40-
[main] IGenerationTerm.Terms changed its return type to IReadOnlyList<string>
41-
[main] IProximityTerm.Terms changed its return type to IReadOnlyList<IProximityOperand>
33+
[main] IGenerationTerm.Terms property changed return type to IReadOnlyList<string>
34+
[main] IProximityTerm.Terms property changed its return type to IReadOnlyList<IProximityOperand>
4235
[main] IOperation properties (PrecedingOperations, FollowingOperations, UndoOperations, IdentifiedEntities) changed return type
43-
[main] HierarchyInfo.Types changed its return type to IReadOnlyList<TypeInfo>
44-
[main] IndexInfo.Columns changed its return type to IReadOnlyList<ColumnInfo>
36+
[main] HierarchyInfo.Types property changed return type to IReadOnlyList<TypeInfo>
37+
[main] IndexInfo.Columns property return type changed to IReadOnlyList<ColumnInfo>
4538
[main] KeyInfo's Fields and Columns properties changed to ReadOnlyList<FieldInfo> and IReadOnlyList<ColumnInfo> respectively
46-
[main] TypeIndexInfoCollection.RealPrimaryIndexes property changed its return type to IReadOnlyList<IndexInfo>
39+
[main] TypeIndexInfoCollection.RealPrimaryIndexes property return type changed to IReadOnlyList<IndexInfo>
4740
[main] TypeIndexInfoCollection.GetIndexesContainingAllData() method changed its return type to IReadOnlyList<IndexInfo>
4841
[main] TypeInfo members that returned IList<T> changed return type to IReadOnlyList<TypeInfo>
4942
[main] PersistRequestBuilderContext.AffectedIndexes changed return type to IReadOnlyList<IndexInfo>
@@ -57,24 +50,26 @@
5750
[main] RemoveFieldHint.AffectedColumns changed return type to IReadOnlyList<string>
5851
[main] RemoveTypeHint.AffectedTables changed return type to IReadOnlyList<string>
5952
[main] SchemaComparisonResult.UnsafeActions changed return type to IReadOnlyList<NodeAction>
60-
[main] UpgradeContext.Hints changed return type to ISet<UpgradeHint>
6153
[main] UpgradeContext.Modules changed return type to IReadOnlyList<IModule>
6254
[main] UpgradeContext.OrderedUpgradeHandlers changed return type to IReadOnlyList<IUpgradeHandler>
6355
[main] UpgradeContext.UpgradeHandlers changed return type to IReadOnlyDictionary<Assembly, IUpgradeHandler>
64-
[main] UpgradeHandler.AddUpgradeHints() and .AddAutoHints() now take ISet<T> from .Net instead of ORM's ISet<T>
65-
[main] KeyMapping.Map changed type to IReadOnlyDictionary<Key, Key>
66-
[main] InterfaceMapping's properties of ReadOnlyList<T> type changed the type to IReadOnlyList<T>
56+
[main] KeyMapping.Map property changed type to .Net IReadOnlyDictionary<Key, Key>
57+
[main] InterfaceMapping's properties of ReadOnlyList<T> type changed the type to .Net IReadOnlyList<T>
6758
[main] Node's IncomingConnections and OutgoingConnections properties changed types to IReadOnlyList<NodeConnection<TNodeItem, TConnectionItem>>
6859
[main] CompositePreCompiler.Items became readonly field and changed its type to IReadOnlyList<IPreCompiler>
69-
[main] SqlCompilerConfiguration's SchemaMapping and DatabaseMapping changed return types to IReadOnlyDictionary<string, string>
70-
[main] TypeMappingRegistry.Mappings and .ReverseMappings changed return types to IReadOnlyDictionary<TKey, TValue>
60+
[main] SqlCompilerConfiguration's SchemaMapping and DatabaseMapping properties changed return types to IReadOnlyDictionary<string, string>
61+
[main] TypeMappingRegistry.Mappings and ReverseMappings properties changed return types to IReadOnlyDictionary<TKey, TValue>
7162
[main] Xtensive.Orm.Services.QueryTranslationResult became read-only structure
7263
[main] Query and ParameterBindings properties of Xtensive.Orm.Services.QueryTranslationResult changed their types and became read-only
73-
[main] SqlTranslator.BuildBatch method changed its parameter from string[] to IReadOnlyList<string>
64+
[main] SqlTranslator.BuildBatch() method changed its parameter from string[] to IReadOnlyList<string>
7465
[main] TypeReference, QueryRequest QueryParameterBinding types became read-only structures
7566
[main] TypeInfoRef, ColumnInfoRef, ColumnGroup and ComparisonRule types became read-only structures
7667
[main] RecordSetHeader constructors changed IEnumerable<T> paremters to IReadOnlyList<T>
7768
[main] ColumnGroupCollection no longer takes IEnumerable<T> as parameter of constructor
7869
[main] ColumnCollection no longer takes IEnumerable<T> as parameter of constructor, only constructor with IReadOnlyList<T> is available now
79-
[firebird] Add support for Firebird 4
70+
[main] Overall perfromance improved
71+
[main] Fixed issue when Execute/CreateDelayedQuery APIs query cache caused long-living objects
72+
[firebird] Added support for Firebird 4
8073
[sqlserver] Microsoft.Data.SqlClient is updated to verson 4.0.0
74+
[mysql] Added support for MySQL 5.7 and 8.0
75+
[mysql] Updated version of Google.Protobuf package

ChangeLog/7.1.0-Beta-2-dev.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[main] Some EventArgs inheritors that were sealed classes transformed to read-only structures
2+
[main] DbCommandEventArgs became read-only structure
3+
[main] BitFaster.Caching package reference is updated to 1.0.7
4+
[main] No error caused by ambiguity due to new IQueryable extension methods of .Net 6
5+
[reprocessing] DomainBuildErrorEventArgs (not sealed) became read-only structure
6+
[reprocessing] ExecuteErrorEventArgs (not sealed) became read-only structure
7+
[tracking] TrackingCompletedEventArgs (sealed) became read-only structure

Directory.Build.props

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,25 @@
4040
<PropertyGroup>
4141
<NoLogo>true</NoLogo>
4242
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
43-
<TargetFramework>net5.0</TargetFramework>
43+
<TargetFrameworks>$(TargetFrameworks)</TargetFrameworks> <!-- the property -->
44+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">$(DO_TargetFrameworks)</TargetFrameworks> <!-- env var -->
45+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net5.0</TargetFrameworks> <!-- fallback to default -->
4446
<LangVersion>9.0</LangVersion>
4547
<SolutionDir Condition="$(SolutionDir) == ''">$([MSBuild]::EnsureTrailingSlash(
4648
$([MSBuild]::GetDirectoryNameOfFileAbove('$(MSBuildThisFileDirectory)', 'Orm.sln'))))</SolutionDir>
4749
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
4850
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
4951
<ArtifactsDir Condition="'$(ArtifactsDir)'==''">$(SolutionDir)_Build\</ArtifactsDir>
5052
<BaseIntermediateOutputPath>$(ArtifactsDir)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
51-
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
53+
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework)\</IntermediateOutputPath>
5254
<BaseOutputPath>$(ArtifactsDir)bin\$(Configuration)\</BaseOutputPath>
5355
<BaseOutputPath Condition="$(MSBuildProjectName.Contains('Tests'))
5456
OR $(MSBuildProjectName) == 'TestCommon'
5557
OR $(MSBuildProjectName) == 'Xtensive.Orm.Manual'">$(ArtifactsDir)tests\$(Configuration)\</BaseOutputPath>
5658
<OutputPath>$(BaseOutputPath)lib\</OutputPath>
5759
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
5860
<ProjectAssetsFile>$(MSBuildProjectExtensionsPath)project.assets.json</ProjectAssetsFile>
59-
<ProjectAssetsCacheFile>$(MSBuildProjectExtensionsPath)$(MSBuildProjectName).assets.cache</ProjectAssetsCacheFile>
61+
<ProjectAssetsCacheFile>$(MSBuildProjectExtensionsPath)$(TargetFramework)\$(MSBuildProjectName).assets.cache</ProjectAssetsCacheFile>
6062
<OrmKeyFile>$(SolutionDir)Orm\Orm.snk</OrmKeyFile>
6163
</PropertyGroup>
6264

Extensions/Xtensive.Orm.BulkOperations/BulkExtensions.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@ public static IUpdatable<T> Set<T, TResult>(this IUpdatable<T> query, Expression
7878
/// <returns>Instance of <see cref=" IUpdatable&lt;T&gt;"/>.</returns>
7979
[Pure]
8080
public static IUpdatable<T> Set<T, TResult>(this IQueryable<T> query, Expression<Func<T, TResult>> field,
81-
TResult value) where T: IEntity =>
82-
Set(query, field, a => value);
81+
TResult value) where T: IEntity
82+
{
83+
// Manually constructed expression is simpler than `a => value`
84+
var valueFunc = Expression.Lambda<Func<T, TResult>>(Expression.Constant(value, typeof(TResult)),
85+
Expression.Parameter(typeof(T), "a"));
86+
87+
return Set(query, field, valueFunc);
88+
}
8389

8490
/// <summary>
8591
/// Executes bulk update of entities specified by the query.

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Linq.Expressions;
1+
using System.Linq.Expressions;
2+
using Xtensive.Linq;
23
using Xtensive.Orm.Model;
34
using Xtensive.Sql.Dml;
45

@@ -16,5 +17,10 @@ internal class AddValueContext
1617
public FieldInfo Field { get; set; }
1718

1819
public bool SubqueryExists { get; set; }
20+
21+
public object EvalLambdaBody() =>
22+
Lambda.Body is ConstantExpression ce
23+
? ce.Value
24+
: FastExpression.Lambda(Lambda.Body).Compile().DynamicInvoke();
1925
}
20-
}
26+
}

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private void AddComputedExpression(AddValueContext addContext)
136136
var sqlSelect = request.Query;
137137
SqlExpression ex = sqlSelect.OrderBy[0].Expression;
138138
parent.Bindings.AddRange(request.ParameterBindings);
139-
139+
140140
if(parent.JoinedTableRef!=null)
141141
ex.AcceptVisitor(new ComputedExpressionSqlVisitor(sqlSelect.From, parent.JoinedTableRef));
142142

@@ -146,10 +146,11 @@ private void AddComputedExpression(AddValueContext addContext)
146146
private void AddConstantValue(AddValueContext addContext)
147147
{
148148
SqlTableColumn column = SqlDml.TableColumn(addContext.Statement.Table, addContext.Field.Column.Name);
149+
var constant = addContext.EvalLambdaBody();
149150
SqlExpression value;
150-
object constant = FastExpression.Lambda(addContext.Lambda.Body).Compile().DynamicInvoke();
151-
if (constant==null)
151+
if (constant == null) {
152152
value = SqlDml.Null;
153+
}
153154
else {
154155
QueryParameterBinding binding = parent.QueryBuilder.CreateParameterBinding(constant.GetType(), context => constant);
155156
parent.Bindings.Add(binding);
@@ -223,7 +224,8 @@ private void AddEntityValue(AddValueContext addContext)
223224
}
224225
}
225226
i = -1;
226-
var entity = (IEntity) FastExpression.Lambda(addContext.Lambda.Body).Compile().DynamicInvoke();
227+
var entity = (IEntity)addContext.EvalLambdaBody();
228+
227229
foreach (ColumnInfo column in addContext.Field.Columns) {
228230
i++;
229231
SqlExpression value;
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
using System;
1+
// Copyright (C) 2012-2022 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
4+
using System;
25

36
namespace Xtensive.Orm.Reprocessing
47
{
58
/// <summary>
69
/// Contains <see cref="ReprocessableDomainBuilder.Error"/> event data.
710
/// </summary>
8-
public class DomainBuildErrorEventArgs : EventArgs
11+
public readonly struct DomainBuildErrorEventArgs
912
{
13+
/// <summary>
14+
/// Gets the exception.
15+
/// </summary>
16+
public Exception Exception { get; }
17+
/// <summary>
18+
/// Gets the attempt number.
19+
/// </summary>
20+
public int Attempt { get; }
21+
1022
/// <summary>
1123
/// Initializes a new instance of the <see cref="DomainBuildErrorEventArgs"/> class.
1224
/// </summary>
@@ -17,14 +29,5 @@ public DomainBuildErrorEventArgs(Exception exception, int attempt)
1729
Exception = exception;
1830
Attempt = attempt;
1931
}
20-
21-
/// <summary>
22-
/// Gets the exception.
23-
/// </summary>
24-
public Exception Exception { get; private set; }
25-
/// <summary>
26-
/// Gets the attempt number.
27-
/// </summary>
28-
public int Attempt { get; private set; }
2932
}
3033
}

Extensions/Xtensive.Orm.Reprocessing/ExecuteErrorEventArgs.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
1-
using System;
1+
// Copyright (C) 2012-2022 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
4+
5+
using System;
26

37
namespace Xtensive.Orm.Reprocessing
48
{
59
/// <summary>
610
/// Provides data for the <see cref="IExecuteActionStrategy.Error"/> event
711
/// </summary>
8-
public class ExecuteErrorEventArgs : EventArgs
12+
public readonly struct ExecuteErrorEventArgs
913
{
1014
/// <summary>
1115
/// Gets the attempt number of this task.
1216
/// </summary>
13-
public int Attempt { get; private set; }
17+
public int Attempt { get; }
1418

1519
/// <summary>
1620
/// Gets the exception of this task.
1721
/// </summary>
18-
public Exception Exception { get; private set; }
22+
public Exception Exception { get; }
1923

2024
/// <summary>
2125
/// Gets the session of this task. Session will have outer transaction.
2226
/// </summary>
23-
public Session Session { get; private set; }
27+
public Session Session { get; }
2428

2529
/// <summary>
2630
/// Gets the transaction of this task.
2731
/// </summary>
28-
public Transaction Transaction { get; private set; }
32+
public Transaction Transaction { get; }
2933

3034
/// <summary>
3135
/// Initializes a new instance of the <see cref="ExecuteErrorEventArgs"/> class.
@@ -42,4 +46,4 @@ public ExecuteErrorEventArgs(Exception exception, Session session, Transaction t
4246
Transaction = transaction;
4347
}
4448
}
45-
}
49+
}
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2019-2020 Xtensive LLC.
1+
// Copyright (C) 2012-2022 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

@@ -10,17 +10,17 @@ namespace Xtensive.Orm.Tracking
1010
/// <summary>
1111
/// Event arguments for <see cref="ITrackingMonitor.TrackingCompleted"/> event.
1212
/// </summary>
13-
public sealed class TrackingCompletedEventArgs : EventArgs
13+
public readonly struct TrackingCompletedEventArgs
1414
{
1515
/// <summary>
1616
/// Gets session this changes occured in.
1717
/// </summary>
18-
public Session Session { get; private set; }
18+
public Session Session { get; }
1919

2020
/// <summary>
2121
/// Gets the changes.
2222
/// </summary>
23-
public IEnumerable<ITrackingItem> Changes { get; private set; }
23+
public IEnumerable<ITrackingItem> Changes { get; }
2424

2525
/// <summary>
2626
/// Initializes a new instance of the <see cref="TrackingCompletedEventArgs"/> class.
@@ -30,13 +30,8 @@ public sealed class TrackingCompletedEventArgs : EventArgs
3030
/// <param name="changes">The changes.</param>
3131
public TrackingCompletedEventArgs(Session session, IEnumerable<ITrackingItem> changes)
3232
{
33-
if (session==null)
34-
throw new ArgumentNullException("session");
35-
if (changes == null)
36-
throw new ArgumentNullException("changes");
37-
38-
Session = session;
39-
Changes = changes;
33+
Session = session ?? throw new ArgumentNullException("session");
34+
Changes = changes ?? throw new ArgumentNullException("changes");
4035
}
4136
}
4237
}

0 commit comments

Comments
 (0)