Skip to content

Commit

Permalink
[修改]1. 修改编译警告
Browse files Browse the repository at this point in the history
  • Loading branch information
AlianBlank committed Jul 4, 2024
1 parent 1e86355 commit 0d41176
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MongoDbService : IGameDbService
/// </summary>
/// <param name="url">MongoDB连接URL。</param>
/// <param name="dbName">要使用的数据库名称。</param>
public async void Open(string url, string dbName)
public void Open(string url, string dbName)
{
try
{
Expand All @@ -47,11 +47,12 @@ public async void Open(string url, string dbName)
/// 获取指定类型的MongoDB集合。
/// </summary>
/// <typeparam name="TState">文档的类型。</typeparam>
/// <param name="settings">集合的设置。</param>
/// <returns>指定类型的MongoDB集合。</returns>
private IMongoCollection<TState> GetCollection<TState>() where TState : ICacheState, new()
private IMongoCollection<TState> GetCollection<TState>(MongoCollectionSettings settings = null) where TState : ICacheState, new()
{
var collectionName = typeof(TState).Name;
IMongoCollection<TState>? collection = CurrentDatabase.GetCollection<TState>(collectionName);
IMongoCollection<TState> collection = CurrentDatabase.GetCollection<TState>(collectionName, settings);
return collection;
}

Expand Down Expand Up @@ -303,7 +304,7 @@ public async void Open(string url, string dbName)
/// </summary>
/// <param name="states"></param>
/// <typeparam name="TState"></typeparam>
public async Task AddListAsync<TState>(List<TState> states) where TState : ICacheState, new()
public async Task AddListAsync<TState>(List<TState> states) where TState : class, ICacheState, new()
{
var collection = GetCollection<TState>();
var cacheStates = states.ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Nullable>disable</Nullable>
<Description>GameFrameX.DBServer</Description>
<PackageTags>GameFrameX,Lib,DBServer,Server,GameServer</PackageTags>
<PublicSign>true</PublicSign>
Expand Down

0 comments on commit 0d41176

Please sign in to comment.