Skip to content

Commit 0d41176

Browse files
committed
[修改]1. 修改编译警告
1 parent 1e86355 commit 0d41176

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

DataBaseServer/GameFrameX.DBServer/DbService/MongoDB/MongoDBExtensions.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

DataBaseServer/GameFrameX.DBServer/DbService/MongoDB/MongoDbService.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class MongoDbService : IGameDbService
2727
/// </summary>
2828
/// <param name="url">MongoDB连接URL。</param>
2929
/// <param name="dbName">要使用的数据库名称。</param>
30-
public async void Open(string url, string dbName)
30+
public void Open(string url, string dbName)
3131
{
3232
try
3333
{
@@ -47,11 +47,12 @@ public async void Open(string url, string dbName)
4747
/// 获取指定类型的MongoDB集合。
4848
/// </summary>
4949
/// <typeparam name="TState">文档的类型。</typeparam>
50+
/// <param name="settings">集合的设置。</param>
5051
/// <returns>指定类型的MongoDB集合。</returns>
51-
private IMongoCollection<TState> GetCollection<TState>() where TState : ICacheState, new()
52+
private IMongoCollection<TState> GetCollection<TState>(MongoCollectionSettings settings = null) where TState : ICacheState, new()
5253
{
5354
var collectionName = typeof(TState).Name;
54-
IMongoCollection<TState>? collection = CurrentDatabase.GetCollection<TState>(collectionName);
55+
IMongoCollection<TState> collection = CurrentDatabase.GetCollection<TState>(collectionName, settings);
5556
return collection;
5657
}
5758

@@ -303,7 +304,7 @@ public async void Open(string url, string dbName)
303304
/// </summary>
304305
/// <param name="states"></param>
305306
/// <typeparam name="TState"></typeparam>
306-
public async Task AddListAsync<TState>(List<TState> states) where TState : ICacheState, new()
307+
public async Task AddListAsync<TState>(List<TState> states) where TState : class, ICacheState, new()
307308
{
308309
var collection = GetCollection<TState>();
309310
var cacheStates = states.ToList();

DataBaseServer/GameFrameX.DBServer/GameFrameX.DBServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
6+
<Nullable>disable</Nullable>
77
<Description>GameFrameX.DBServer</Description>
88
<PackageTags>GameFrameX,Lib,DBServer,Server,GameServer</PackageTags>
99
<PublicSign>true</PublicSign>

0 commit comments

Comments
 (0)