Skip to content

Commit 6c87b82

Browse files
committed
Merge branch '7.0' into 7.0-nodecollection-add-imp
# Conflicts: # Orm/Xtensive.Orm/Sql/Model/NodeCollection.cs
2 parents e3d24b6 + bcc4620 commit 6c87b82

File tree

88 files changed

+7333
-1021
lines changed

Some content is hidden

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

88 files changed

+7333
-1021
lines changed

ChangeLog/6.0.13_Z_Final.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[main] Fixed certain cases of bad translation of casts via 'as' operator in LINQ queries
2+
[main] Addressed certain issues of translation connected with comparison with local entity instace within LINQ queries
3+
[main] Fixed rare issues of incorrect translation of filtered index expressions including conditional expressions
4+
[main] Join/LeftJoin is denied to have the same expression instance for both inner/outer selector
5+
[main] Addressed issue when wrong type of join was chosen when .First/FirstOrDefalult() method was used as subquery
6+
[main] Added dedicated exception when RenameFieldHint.TargetType exists in current model but absent in storage model
7+
[main] Xtensive.Sql.Model.NodeCollection<T>.Add() throws understandable exception in case of duplicate name of item
8+
[postgresql] Fixed issue of incorrect translation of contitional expressions including comparison with nullable fields

Directory.Build.props

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<ProjectAssetsFile>$(MSBuildProjectExtensionsPath)project.assets.json</ProjectAssetsFile>
5656
<ProjectAssetsCacheFile>$(MSBuildProjectExtensionsPath)$(MSBuildProjectName).assets.cache</ProjectAssetsCacheFile>
5757
<OrmKeyFile>$(SolutionDir)Orm\Orm.snk</OrmKeyFile>
58+
<NoWarn>$(NoWarn);NETSDK1138</NoWarn>
5859
</PropertyGroup>
5960

6061
<!-- Populate standard properties. -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Xtensive.Orm.BulkOperations
2+
===========================
3+
4+
Summary
5+
-------
6+
The extension provides a set of IQueryable extension methods that are translated
7+
to server-side UPDATE or DELETE commands.
8+
9+
Prerequisites
10+
-------------
11+
DataObjects.Net 6.0.x (http://dataobjects.net)
12+
13+
14+
Examples of usage
15+
-----------------
16+
17+
**Example #1**. Update primitive property with a constant value:
18+
19+
```csharp
20+
session.Query.All<Bar>()
21+
.Where(a => a.Id == 1)
22+
.Set(a => a.Count, 2)
23+
Update();
24+
```
25+
26+
**Example #2** Updating persistent property with expression, computed on server:
27+
28+
```csharp
29+
session.Query.All<Bar>()
30+
.Where(a => a.Id==1)
31+
.Set(a => a.Count, a => a.Description.Length)
32+
.Update();
33+
```
34+
35+
**Example #3**. Setting a reference to an entity that is already loaded into current Session
36+
37+
```csharp
38+
// Emulating entity loading
39+
var bar = session.Query.Single<Bar>(1);
40+
41+
session.Query.All<Foo>()
42+
.Where(a => a.Id == 2)
43+
.Set(a => a.Bar, bar)
44+
.Update();
45+
```
46+
47+
**Example #4**. Setting a reference to an entity that is not loaded into Session, 1st way
48+
49+
```csharp
50+
session.Query.All<Foo>()
51+
.Where(a => a.Id == 1)
52+
.Set(a => a.Bar, a => Query.Single<Bar>(1))
53+
.Update();
54+
```
55+
56+
**Example #5**. Setting a reference to an entity that is not loaded into Session, 2nd way
57+
58+
```csharp
59+
session.Query.All<Foo>()
60+
.Where(a => a.Id == 1)
61+
.Set(a => a.Bar, a => Query.All<Bar>().Single(b => b.Name == "test"))
62+
.Update();
63+
```
64+
65+
**Example #6**. Constructing update expressions of the fly
66+
67+
```csharp
68+
bool condition = CheckCondition();
69+
var query = session.Query.All()<Bar>
70+
.Where(a => a.Id == 1)
71+
.Set(a => a.Count, 2);
72+
73+
if(condition)
74+
query = query.Set(a => a.Name, a => a.Name + "test");
75+
query.Update();
76+
```
77+
78+
**Example #7**. Updating lots of properties at once
79+
80+
```csharp
81+
session.Query.All<Bar>()
82+
.Where(a => a.Id == 1)
83+
Update(
84+
a => new Bar(null) { Count = 2, Name = a.Name + "test", /*dozens of other properties...*/ });
85+
```
86+
87+
**Example #8**. Deleting entities
88+
89+
```csharp
90+
session.Query.All<Foo>()
91+
.Where(a => a.Id == 1)
92+
.Delete();
93+
```

Extensions/Xtensive.Orm.BulkOperations/Readme.txt

-83
This file was deleted.

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
<AssemblyOriginatorKeyFile>$(ExtensionsKeyFile)</AssemblyOriginatorKeyFile>
1313
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1414
</PropertyGroup>
15-
<ItemGroup>
16-
<None Include="Readme.txt" />
15+
<PropertyGroup Label="Nuget ReadMe" Condition="$(GeneratePackageOnBuild) == 'true'">
16+
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
17+
</PropertyGroup>
18+
<ItemGroup Label="Nuget content">
19+
<Content Include="$(ProjectDir)NuGetContent\**">
20+
<PackagePath>.</PackagePath>
21+
</Content>
1722
</ItemGroup>
1823
<ItemGroup>
1924
<ProjectReference Include="..\..\Orm\Xtensive.Orm\Xtensive.Orm.csproj" />
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
=========================
21
Xtensive.Orm.Localization
32
=========================
43

@@ -9,35 +8,14 @@ This implies that localizable resources are a part of domain model so they are s
98

109
Prerequisites
1110
-------------
12-
DataObjects.Net Core 0.1 or later (http://dataobjects.net)
11+
DataObjects.Net 6.0.x or later (http://dataobjects.net)
1312

1413
Implementation
1514
--------------
16-
1. Add reference to Xtensive.Orm.Localization assembly
17-
2. Include types from Xtensive.Orm.Localization assembly into the domain:
18-
19-
<Xtensive.Orm>
20-
<domains>
21-
<domain ... >
22-
<types>
23-
<add assembly="your assembly"/>
24-
<add assembly="Xtensive.Orm.Localization"/>
25-
</types>
26-
</domain>
27-
</domains>
28-
</Xtensive.Orm>
29-
30-
2.1 Optionally add default localization configuration
31-
<configSections>
32-
<section name="Xtensive.Orm.Localization" type="Xtensive.Orm.Localization.Configuration.ConfigurationSection, Xtensive.Orm.Localization"/>
33-
</configSections>
34-
35-
<Xtensive.Orm.Localization>
36-
<defaultCulture name="es-ES"/>
37-
</Xtensive.Orm.Localization>
38-
39-
3. Implement ILocalizable<TLocalization> on your localizable entities, e.g.:
4015

16+
Implement ILocalizable<TLocalization> on your localizable entities, e.g.:
17+
18+
```csharp
4119
[HierarchyRoot]
4220
public class Page : Entity, ILocalizable<PageLocalization>
4321
{
@@ -56,9 +34,11 @@ Implementation
5634

5735
public Page(Session session) : base(session) {}
5836
}
37+
```
5938

60-
4. Define corresponding localizations, e.g.:
39+
Define corresponding localizations, e.g.:
6140

41+
```csharp
6242
[HierarchyRoot]
6343
public class PageLocalization : Localization<Page>
6444
{
@@ -68,42 +48,53 @@ Implementation
6848
public PageLocalization(Session session, CultureInfo culture, Page target)
6949
: base(session, culture, target) {}
7050
}
51+
```
52+
53+
Examples of usage
54+
-----------------
7155

72-
Demo
73-
----
74-
1. Access localizable properties as regular ones, e.g.:
56+
**Example #1**. Access localizable properties as regular ones, e.g.:
7557

58+
```csharp
7659
page.Title = "Welcome";
7760
string title = page.Title;
61+
```
7862

79-
2. Mass editing of localizable properties:
63+
**Example #2**. Mass editing of localizable properties:
8064

65+
```csharp
8166
var en = new CultureInfo("en-US");
8267
var sp = new CultureInfo("es-ES");
8368
var page = new Page(session);
8469
page.Localizations[en].Title = "Welcome";
8570
page.Localizations[sp].Title = "Bienvenido";
71+
```
8672

87-
3. Value of localizable properties reflects culture of the current Thread, e.g.:
73+
**Example #3**. Value of localizable properties reflects culture of the current Thread, e.g.:
8874

75+
```csharp
8976
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
9077
string title = page.Title; // title is "Welcome"
9178
9279
Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES");
9380
string title = page.Title; // title is "Bienvenido"
81+
```
9482

95-
4. Instead of altering CurrentThread, instance of LocalizationScope can be used, e.g.:
83+
**Example #4**. Instead of altering CurrentThread, instance of LocalizationScope can be used, e.g.:
9684

85+
```csharp
9786
using (new LocalizationScope(new CultureInfo("en-US"))) {
9887
string title = page.Title; // title is "Welcome"
9988
}
10089

10190
using (new LocalizationScope(new CultureInfo("es-ES"))) {
10291
string title = page.Title; // title is "Bienvenido"
10392
}
93+
```
10494

105-
5. LINQ queries that include localizable properties are transparently translated
95+
**Example #5**. LINQ queries that include localizable properties are transparently translated
10696

97+
```csharp
10798
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
10899
var query = from p in session.Query.All<Page>()
109100
where p.Title=="Welcome"
@@ -115,8 +106,4 @@ Demo
115106
where p.Title=="Bienvenido"
116107
select p;
117108
Assert.AreEqual(1, query.Count());
118-
119-
120-
References
121-
----------
122-
http://doextensions.codeplex.com
109+
```

Extensions/Xtensive.Orm.Localization/Xtensive.Orm.Localization.csproj

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@
1111
<SignAssembly>true</SignAssembly>
1212
<AssemblyOriginatorKeyFile>$(ExtensionsKeyFile)</AssemblyOriginatorKeyFile>
1313
</PropertyGroup>
14-
<Import Project="$(SolutionDir)MSBuild\DataObjects.Net.InternalBuild.targets" />
14+
<PropertyGroup Label="Nuget ReadMe" Condition="$(GeneratePackageOnBuild) == 'true'">
15+
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
16+
</PropertyGroup>
17+
<Import Project="..\..\MSBuild\DataObjects.Net.InternalBuild.targets" />
1518
<ItemGroup>
1619
<ProjectReference Include="..\..\Orm\Xtensive.Orm\Xtensive.Orm.csproj" />
1720
</ItemGroup>
18-
<ItemGroup>
19-
<None Include="Readme.txt" />
21+
<ItemGroup Label="Nuget content">
22+
<Content Include="$(ProjectDir)NuGetContent\**">
23+
<PackagePath>.</PackagePath>
24+
</Content>
2025
</ItemGroup>
2126
<ItemGroup>
2227
<Folder Include="Properties\" />

Extensions/Xtensive.Orm.Logging.NLog/Log.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2013-2020 Xtensive LLC.
1+
// Copyright (C) 2013-2023 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
// Created by: Dmitri Maximov

Extensions/Xtensive.Orm.Logging.NLog/LogProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2013-2020 Xtensive LLC.
1+
// Copyright (C) 2013-2023 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
// Created by: Dmitri Maximov

0 commit comments

Comments
 (0)