Skip to content

Commit 0a08298

Browse files
authored
Merge pull request #8 from LithWang/master
release/2.5.0
2 parents 2ed73ea + 7e5fdbf commit 0a08298

File tree

76 files changed

+2908
-1914
lines changed

Some content is hidden

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

76 files changed

+2908
-1914
lines changed

Publish/DevOps3/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# DevOps 3.7
2+
# DevOps 3.8
33

44

55
# build-bash
@@ -24,6 +24,11 @@ if this file exists, will not need approval for jenkins build.
2424
----------------------------------------------
2525
# ReleaseLog
2626

27+
-----------------------
28+
# 3.8
29+
> 2024-12-19
30+
- upgrade net to 8.0
31+
2732
-----------------------
2833
# 3.7
2934
> 2024-09-21

Publish/DevOps3/build-bash/10.Test.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ docker run -i --rm \
3737
-v $NUGET_PATH:/root/.nuget \
3838
-v "$basePath":/root/code \
3939
-v "$basePath":"$basePath" \
40-
serset/dotnet:sdk-6.0 \
40+
serset/dotnet:sdk-8.0 \
4141
bash -c "
4242
set -e
4343

Publish/DevOps3/build-bash/30.nuget-pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ docker run -i --rm \
2222
--env LANG=C.UTF-8 \
2323
-v $NUGET_PATH:/root/.nuget \
2424
-v $basePath:/root/code \
25-
serset/dotnet:sdk-6.0 \
25+
serset/dotnet:sdk-8.0 \
2626
bash -c "
2727
2828
publishPath=/root/code/Publish/release/release/nuget

Publish/DevOps3/build-bash/40.Station-publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ docker run -i --rm \
2323
-v $NUGET_PATH:/root/.nuget \
2424
-v "$basePath":/root/code \
2525
-v "$basePath":"$basePath" \
26-
serset/dotnet:sdk-6.0 \
26+
serset/dotnet:sdk-8.0 \
2727
bash -c "
2828
set -e
2929

Publish/DevOps3/release-bash/72.nuget-push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fi
2525
docker run -i --rm \
2626
--env LANG=C.UTF-8 \
2727
-v $basePath:/root/code \
28-
serset/dotnet:sdk-6.0 \
28+
serset/dotnet:sdk-8.0 \
2929
bash -c "
3030
for file in /root/code/Publish/release/release/nuget/*.nupkg
3131
do

Publish/environment/build-bash__10.Test__#1.InitEnv.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,27 @@ export basePath=/root/temp
1313

1414
#---------------------------------------------------------------------
1515
echo '#build-bash__10.Test__#1.InitEnv.sh -> #1 start MongoDB container'
16+
17+
18+
docker rm vitorm-mongodb2 -f || true
1619
docker rm vitorm-mongodb -f || true
17-
docker run -d \
18-
--name vitorm-mongodb \
19-
-p 27017:27017 \
20-
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin \
21-
-e MONGO_INITDB_ROOT_PASSWORD=mongoadminsecret \
22-
mongo:4.4.29
20+
21+
docker run -d --net host --name vitorm-mongodb mongo:4.4.29 mongod --replSet my-mongo-set
22+
docker run -d --net host --name vitorm-mongodb2 mongo:4.4.29 mongod --port 27018 --replSet my-mongo-set
23+
24+
25+
#---------------------------------------------------------------------
26+
echo '#build-bash__10.Test__#1.InitEnv.sh -> #2 wait for MongoDB to init'
27+
docker run -t --rm --net host mongo:4.4.29 timeout 120 sh -c "until (echo 'use db_orm;' | mongo); do echo waiting for MongoDB; sleep 2; done;"
28+
29+
docker run -t --rm --net host mongo:4.4.29 timeout 120 sh -c "until (echo 'use db_orm;' | mongo --host localhost --port 27018); do echo waiting for MongoDB; sleep 2; done;"
2330

2431

2532
#---------------------------------------------------------------------
26-
echo '#build-bash__10.Test__#1.InitEnv.sh -> #8 wait for MongoDB to init'
27-
docker run -t --rm --link vitorm-mongodb mongo:4.4.29 timeout 120 sh -c "until (echo 'use db_dev' | mongo --host vitorm-mongodb -u mongoadmin -p mongoadminsecret); do echo waiting for MongoDB; sleep 2; done;"
33+
echo '#build-bash__10.Test__#1.InitEnv.sh -> #3 start replica set'
34+
docker run -t --rm --net host mongo:4.4.29 sh -c "echo 'rs.initiate({\"_id\":\"my-mongo-set\",\"members\":[{\"_id\":0,\"host\":\"localhost:27017\"},{\"_id\":1,\"host\":\"localhost:27018\"}]})' | mongo"
2835

36+
docker run -t --rm --net host mongo:4.4.29 timeout 120 sh -c "until (echo 'use db_orm;\nuse db_orm2;' | mongo); do echo waiting for MongoDB; sleep 2; done;"
2937

3038

3139
#---------------------------------------------------------------------

Publish/environment/build-bash__10.Test__#3.CleanEnv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ echo '#build-bash__10.Test_#3.CleanEnv.sh'
1616

1717

1818
echo '#build-bash__10.Test_#3.CleanEnv.sh -> #1 remove MongoDB'
19+
docker rm vitorm-mongodb2 -f || true
1920
docker rm vitorm-mongodb -f || true
2021

2122

22-

doc/ReleaseNotes.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
# Vitorm.MongoDB ReleaseNotes
2+
3+
-----------------------
4+
# 2.4.0
5+
- support Transaction
6+
- upgrade net to 8.0
7+
- support group query
8+
- support PlainDistinctSearch
9+
- support Count
10+
- support ToListAsync
11+
- support ToExecuteString
12+
- support FirstOrDefault
13+

src/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>2.3.0-develop</Version>
4-
<Vitorm_Version>[2.3.0, 2.4.0)</Vitorm_Version>
3+
<Version>2.5.0</Version>
4+
<Vitorm_Version>[2.5.0, 2.6.0)</Vitorm_Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/Vitorm.MongoDB/DbConfig.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ namespace Vitorm.MongoDB
77
{
88
public class DbConfig
99
{
10-
public DbConfig(string connectionString, int? commandTimeout = null)
11-
{
12-
this.connectionString = connectionString;
13-
this.commandTimeout = commandTimeout;
14-
}
15-
public DbConfig(string connectionString, string readOnlyConnectionString, int? commandTimeout = null)
10+
public DbConfig(string database, string connectionString, string readOnlyConnectionString = null, int? commandTimeout = null)
1611
{
12+
this.database = database;
1713
this.connectionString = connectionString;
1814
this.readOnlyConnectionString = readOnlyConnectionString;
1915
this.commandTimeout = commandTimeout;
@@ -35,31 +31,35 @@ public DbConfig(Dictionary<string, object> config)
3531
if (config.TryGetValue("commandTimeout", out value) && value is Int32 commandTimeout)
3632
this.commandTimeout = commandTimeout;
3733
}
38-
public string database { get; set; }
34+
public string database { get; protected set; }
3935

40-
public string connectionString { get; set; }
41-
public string readOnlyConnectionString { get; set; }
42-
public int? commandTimeout { get; set; }
36+
public string connectionString { get; protected set; }
37+
public string readOnlyConnectionString { get; protected set; }
38+
public int? commandTimeout { get; protected set; }
4339

44-
MongoClient client;
45-
MongoClient readOnlyClient;
40+
protected MongoClient client;
41+
protected MongoClient readOnlyClient;
4642

47-
MongoClient Client => client ??= new MongoClient(connectionString);
48-
MongoClient ReadOnlyClient => readOnlyClient ??= new MongoClient(readOnlyConnectionString);
43+
public virtual MongoClient Client => client ??= new MongoClient(connectionString);
44+
public virtual MongoClient ReadOnlyClient => readOnlyClient ??= new MongoClient(readOnlyConnectionString);
4945

50-
public IMongoDatabase GetDatabase() => Client.GetDatabase(database);
51-
public IMongoDatabase GetReadOnlyDatabase() => ReadOnlyClient.GetDatabase(database);
46+
public virtual IMongoDatabase GetDatabase() => Client.GetDatabase(database);
47+
public virtual IMongoDatabase GetReadOnlyDatabase() => ReadOnlyClient.GetDatabase(database);
5248

5349

50+
public virtual DbConfig WithDatabase(string databaseName)
51+
{
52+
return new(databaseName, connectionString, readOnlyConnectionString, commandTimeout);
53+
}
5454

5555

56-
internal string dbHashCode => connectionString.GetHashCode().ToString();
56+
internal string dbHashCode => connectionString.GetHashCode().ToString() + "::" + database;
5757

5858

5959

6060
/// <summary>
6161
/// to identify whether contexts are from the same database
6262
/// </summary>
63-
public virtual string dbGroupName => "DbSet_" + dbHashCode;
63+
public virtual string dbGroupName => "MongoDb_DbSet_" + dbHashCode;
6464
}
6565
}

0 commit comments

Comments
 (0)