net8, language features, bugfixes
This commit is contained in:
parent
1591618c2c
commit
ce99053a10
353 changed files with 3245 additions and 3944 deletions
|
|
@ -7,14 +7,9 @@ using MongoDB.Driver;
|
|||
|
||||
namespace Insight.Server.Network.Agent.Handlers;
|
||||
|
||||
public class DriveHandler : IMessageHandler<AgentSession>
|
||||
public class DriveHandler(IMongoDatabase database) : IMessageHandler<AgentSession>
|
||||
{
|
||||
private readonly IMongoDatabase _database;
|
||||
|
||||
public DriveHandler(IMongoDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
private readonly IMongoDatabase _database = database;
|
||||
|
||||
public async ValueTask HandleAsync<TMessage>(AgentSession sender, TMessage message, CancellationToken cancellationToken) where TMessage : IMessage
|
||||
{
|
||||
|
|
@ -39,7 +34,7 @@ public class DriveHandler : IMessageHandler<AgentSession>
|
|||
|
||||
var driveBulk = new List<WriteModel<HostDriveEntity>>();
|
||||
|
||||
if (drives is not null && drives.Any())
|
||||
if (drives is not null && drives.Count != 0)
|
||||
{
|
||||
foreach (var drive in drives)
|
||||
{
|
||||
|
|
@ -83,16 +78,16 @@ public class DriveHandler : IMessageHandler<AgentSession>
|
|||
|
||||
var volumeBulk = new List<WriteModel<HostVolumeEntity>>();
|
||||
|
||||
if (drives is not null && drives.Any())
|
||||
if (drives is not null && drives.Count != 0)
|
||||
{
|
||||
foreach (var drive in drives)
|
||||
{
|
||||
var driveId = await _database.HostDrive()
|
||||
.Find(p => p.Host == hostEntity.Id && p.Index == drive.Index)
|
||||
.Project(p => p.Id)
|
||||
.FirstOrDefaultAsync();
|
||||
.FirstOrDefaultAsync(cancellationToken: default);
|
||||
|
||||
if (drive.Volumes is not null && drive.Volumes.Any())
|
||||
if (drive.Volumes is not null && drive.Volumes.Count != 0)
|
||||
{
|
||||
foreach (var volume in drive.Volumes)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue