Skip to content

Commit 88f9a09

Browse files
authored
Merge branch 'master' into upstream/OptimizeTracking
2 parents 2ff8bcf + a876491 commit 88f9a09

File tree

390 files changed

+3574
-3318
lines changed

Some content is hidden

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

390 files changed

+3574
-3318
lines changed
Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +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
2215
[main] SqlTranslator/SqlCompiler APIs were significantly changed in order to improve memory usage and perfromance
2316
[main] Introduced IQueryable<T>.Tag() extensions allowing to add tags to result SQL statement
2417
[main] Introduced Session.Tag() method for being able to tag queries within returned TagScope
25-
[main] Domain.TagsEnabled is introduced as faster alternative to DomainConfiguration.TagLocation!=TagLocation.Nowhere check
26-
[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
2719
[main] NativeTypeClassifier collection now inherits ClassifiedCollection directly
28-
[main] FlagCollection.Keys return type has changed from removed ReadOnlyList<T> to .Net IReadOnlyList<T>
20+
[main] FlagCollection.Keys no returns .Net IReadOnlyList<TKey>
2921
[main] CollectionBaseSlim<T> no longer implements IList<T> and ICollection but implements ICollection<T> and IReadOnlyList<T>
3022
[main] AggregateException.Exceptions property changed its return type to IReadOnlyList<Exception>
3123
[main] AggregateException constuctors get array of exceptions instead of IEnumerable<Exception>
3224
[main] CopyDataHint.CopiedColumns property changed its return type to IReadOnlyList<Pair<string>>
33-
[main] DateHint.Identitites property changed its return type to IReadOnlyList<IdentityPair>
34-
[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>>
3527
[main] IUpgrader methods now return IReadOnlyList<NodeAction>
36-
[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
3729
[main] FullTextIndexDefCollection changed its base type to CollectionBaseSlim<FullTextIndexDef>
38-
[main] HierarchyDefCollection changed its base type to CollectionBaseSlim<HierarchyDef>
30+
[main] HierarchyDefCollection base type changed to CollectionBaseSlim<HierarchyDef>
3931
[main] HierarchyDefCollection and TypeDefCollection changed events set due to change of base type
4032
[main] SessionConfiguration collection API changed due to changes in base type CollectionBaseSlim<T>
41-
[main] IGenerationTerm.Terms changed its return type to IReadOnlyList<string>
42-
[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>
4335
[main] IOperation properties (PrecedingOperations, FollowingOperations, UndoOperations, IdentifiedEntities) changed return type
44-
[main] HierarchyInfo.Types changed its return type to IReadOnlyList<TypeInfo>
45-
[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>
4638
[main] KeyInfo's Fields and Columns properties changed to ReadOnlyList<FieldInfo> and IReadOnlyList<ColumnInfo> respectively
47-
[main] TypeIndexInfoCollection.RealPrimaryIndexes property changed its return type to IReadOnlyList<IndexInfo>
39+
[main] TypeIndexInfoCollection.RealPrimaryIndexes property return type changed to IReadOnlyList<IndexInfo>
4840
[main] TypeIndexInfoCollection.GetIndexesContainingAllData() method changed its return type to IReadOnlyList<IndexInfo>
4941
[main] TypeInfo members that returned IList<T> changed return type to IReadOnlyList<TypeInfo>
5042
[main] PersistRequestBuilderContext.AffectedIndexes changed return type to IReadOnlyList<IndexInfo>
@@ -58,24 +50,26 @@
5850
[main] RemoveFieldHint.AffectedColumns changed return type to IReadOnlyList<string>
5951
[main] RemoveTypeHint.AffectedTables changed return type to IReadOnlyList<string>
6052
[main] SchemaComparisonResult.UnsafeActions changed return type to IReadOnlyList<NodeAction>
61-
[main] UpgradeContext.Hints changed return type to ISet<UpgradeHint>
6253
[main] UpgradeContext.Modules changed return type to IReadOnlyList<IModule>
6354
[main] UpgradeContext.OrderedUpgradeHandlers changed return type to IReadOnlyList<IUpgradeHandler>
6455
[main] UpgradeContext.UpgradeHandlers changed return type to IReadOnlyDictionary<Assembly, IUpgradeHandler>
65-
[main] UpgradeHandler.AddUpgradeHints() and .AddAutoHints() now take ISet<T> from .Net instead of ORM's ISet<T>
66-
[main] KeyMapping.Map changed type to IReadOnlyDictionary<Key, Key>
67-
[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>
6858
[main] Node's IncomingConnections and OutgoingConnections properties changed types to IReadOnlyList<NodeConnection<TNodeItem, TConnectionItem>>
6959
[main] CompositePreCompiler.Items became readonly field and changed its type to IReadOnlyList<IPreCompiler>
70-
[main] SqlCompilerConfiguration's SchemaMapping and DatabaseMapping changed return types to IReadOnlyDictionary<string, string>
71-
[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>
7262
[main] Xtensive.Orm.Services.QueryTranslationResult became read-only structure
7363
[main] Query and ParameterBindings properties of Xtensive.Orm.Services.QueryTranslationResult changed their types and became read-only
74-
[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>
7565
[main] TypeReference, QueryRequest QueryParameterBinding types became read-only structures
7666
[main] TypeInfoRef, ColumnInfoRef, ColumnGroup and ComparisonRule types became read-only structures
7767
[main] RecordSetHeader constructors changed IEnumerable<T> paremters to IReadOnlyList<T>
7868
[main] ColumnGroupCollection no longer takes IEnumerable<T> as parameter of constructor
7969
[main] ColumnCollection no longer takes IEnumerable<T> as parameter of constructor, only constructor with IReadOnlyList<T> is available now
80-
[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
8173
[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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[main] Obsolete CatalogHelper class has been removed
2+
[main] Obsolete ReacreateTableHint has been removed
3+
[main] Obsolete Session.SelectStorageNode() method is removed
4+
[main] Obsolete methods from ArrayExtensions, EnumerableExtensions and QueryableExtensions have been removed
5+
[main] Obsolete DeleteDataHint.PostCopy property has been removed
6+
[main] Obsolete QueryEndpoint's members have been removed
7+
[main] Obsolete Query's members have been removed
8+
[main] Obsolete members of DelayedScalarQuery<T> have been removed
9+
[main] Obsolete FieldInfo.IsDynalicallyDefined property's been removed (FieldInfo.IsDynamicallyDefined is still there)
10+
[main] Some EventArgs inheritors that were sealed classes transformed to read-only structures
11+
[main] DbCommandEventArgs became read-only structure
12+
[main] SqlCustomFunctionCall and SqlFunctionCall share one base type
13+
[main] SqlFunctionCall.Arguments property is IReadOnlyList now and parameters can't be changed after instance creation
14+
[main] Xtensive.Sql.Dml.Extensions.IsNullReference() extension method is marked obsolete, use 'is null' operator instead
15+
[main] BitFaster.Caching package reference is updated to 1.0.7
16+
[main] No error caused by ambiguity due to new IQueryable extension methods of .Net 6
17+
[reprocessing] DomainBuildErrorEventArgs (not sealed) became read-only structure
18+
[reprocessing] ExecuteErrorEventArgs (not sealed) became read-only structure
19+
[tracking] TrackingCompletedEventArgs (sealed) became read-only structure
20+
[Web] Removed Obsolete SessionManager and StartupConfigurationExtension

Directory.Build.props

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,48 @@
3333
<DoGeneratePackage Condition="$(MSBuildProjectName) == 'TestCommon'">false</DoGeneratePackage>
3434
<DoGeneratePackage Condition="$(MSBuildProjectName.Contains('Tests')) == 'true'">false</DoGeneratePackage>
3535

36+
<!-- BuildingInsideVisualStudio is also true in Rider -->
37+
<DoIsIdeBuild>false</DoIsIdeBuild>
38+
<DoIsIdeBuild Condition="$(BuildingInsideVisualStudio) == 'true'">true</DoIsIdeBuild>
39+
3640
<!-- Disable "BinaryFormatter is obsolete" warnings for test projects -->
3741
<NoWarn Condition="$(MSBuildProjectName.Contains('Tests')) == 'true'">$(NoWarn);SYSLIB0011</NoWarn>
3842
</PropertyGroup>
3943

44+
<!-- Debug-NET6, Release-NET6 are mostly for development convenience -->
45+
<PropertyGroup Condition = "$(Configuration.Contains('NET6')) == 'true'">
46+
<!-- hard binding to net6, no property and env variable allowed -->
47+
<TargetFrameworks>net6.0</TargetFrameworks>
48+
</PropertyGroup>
49+
50+
<!-- Debug-NET5, Release-NET5 are mostly for development convenience -->
51+
<PropertyGroup Condition = "$(Configuration.Contains('NET5')) == 'true'">
52+
<!-- hard binding to net5, no property and env variable allowed-->
53+
<TargetFrameworks>net5.0</TargetFrameworks>
54+
</PropertyGroup>
55+
56+
<!--Release and Debug are for final builds, builds on build server, etc. Target frameworks are configurable here -->
57+
<PropertyGroup Label="Defaults" Condition="$(Configuration.Contains('NET5')) == 'false' AND $(Configuration.Contains('NET6')) == 'false'">
58+
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
59+
<TargetFrameworks>$(TargetFrameworks)</TargetFrameworks> <!-- the property -->
60+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">$(DO_TargetFrameworks)</TargetFrameworks> <!-- env var -->
61+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net6.0;net5.0</TargetFrameworks> <!-- fallback to default -->
62+
</PropertyGroup>
63+
64+
<PropertyGroup Condition = "$(Configuration.Contains('Debug')) == 'true'">
65+
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
66+
</PropertyGroup>
67+
68+
<PropertyGroup Condition = "$(Configuration.Contains('Release')) == 'true'">
69+
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
70+
</PropertyGroup>
71+
4072
<PropertyGroup>
4173
<NoLogo>true</NoLogo>
4274
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
43-
<TargetFramework>net5.0</TargetFramework>
4475
<LangVersion>9.0</LangVersion>
4576
<SolutionDir Condition="$(SolutionDir) == ''">$([MSBuild]::EnsureTrailingSlash(
4677
$([MSBuild]::GetDirectoryNameOfFileAbove('$(MSBuildThisFileDirectory)', 'Orm.sln'))))</SolutionDir>
47-
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
4878
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
4979
<ArtifactsDir Condition="'$(ArtifactsDir)'==''">$(SolutionDir)_Build\</ArtifactsDir>
5080
<BaseIntermediateOutputPath>$(ArtifactsDir)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
@@ -54,9 +84,9 @@
5484
OR $(MSBuildProjectName) == 'TestCommon'
5585
OR $(MSBuildProjectName) == 'Xtensive.Orm.Manual'">$(ArtifactsDir)tests\$(Configuration)\</BaseOutputPath>
5686
<OutputPath>$(BaseOutputPath)lib\</OutputPath>
57-
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
87+
<MSBuildProjectExtensionsPath>$(IntermediateOutputPath)</MSBuildProjectExtensionsPath>
5888
<ProjectAssetsFile>$(MSBuildProjectExtensionsPath)project.assets.json</ProjectAssetsFile>
59-
<ProjectAssetsCacheFile>$(MSBuildProjectExtensionsPath)$(MSBuildProjectName).assets.cache</ProjectAssetsCacheFile>
89+
<ProjectAssetsCacheFile>$(MSBuildProjectExtensionsPath)$(TargetFramework)\$(MSBuildProjectName).assets.cache</ProjectAssetsCacheFile>
6090
<OrmKeyFile>$(SolutionDir)Orm\Orm.snk</OrmKeyFile>
6191
</PropertyGroup>
6292

Directory.Build.targets

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<!--
5+
Restores packages if needed. This helps VS to not go crazy on build configuration change
6+
-->
7+
<Target Name="DORestorePackages" BeforeTargets="PrepareForBuild"
8+
Condition="!Exists($(ProjectAssetsFile)) AND $(DoIsIdeBuild)=='true'">
9+
<CallTarget Targets="Restore" />
10+
</Target>
11+
</Project>

Extensions/TestCommon/TestCommon.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<DocumentationFile />
4+
<Configurations>Debug;Release;Debug-NET5;Release-NET5;Debug-NET6;Release-NET6;</Configurations>
45
</PropertyGroup>
56
<PropertyGroup>
67
<SignAssembly>true</SignAssembly>

Extensions/Xtensive.Orm.BulkOperations.Tests/Xtensive.Orm.BulkOperations.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<DocumentationFile />
4+
<Configurations>Debug;Release;Debug-NET5;Release-NET5;Debug-NET6;Release-NET6;</Configurations>
45
</PropertyGroup>
56
<Import Project="$(SolutionDir)MSBuild\DataObjects.Net.InternalBuild.targets" />
67
<ItemGroup>

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/QueryOperation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ private void JoinViaIn(SqlStatement statement, SqlSelect select)
142142
var s = (SqlSelect) select.Clone();
143143
foreach (var column in columns) {
144144
var ex = SqlDml.Equals(s.From.Columns[column.Name], table.Columns[column.Name]);
145-
s.Where = s.Where.IsNullReference() ? ex : SqlDml.And(s.Where, ex);
145+
s.Where = s.Where is null ? ex : SqlDml.And(s.Where, ex);
146146
}
147147
var existingColumns = s.Columns.ToChainedBuffer();
148148
s.Columns.Clear();
149149
var columnToAdd = existingColumns.First(c => c.Name.Equals(columnInfo.Name, StringComparison.Ordinal));
150150
s.Columns.Add(columnToAdd);
151151
var @in = SqlDml.In(SqlDml.TableColumn(table, columnInfo.Name), s);
152-
where = where.IsNullReference() ? @in : SqlDml.And(where, @in);
152+
where = where is null ? @in : SqlDml.And(where, @in);
153153
columns.Add(columnInfo);
154154
}
155155

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;

0 commit comments

Comments
 (0)