FileSqlServerSync/Server/LocalServer/LocalSyncServerFactory.cs

33 lines
707 B
C#
Raw Normal View History

using Common;
namespace LocalServer;
public class LocalSyncServerFactory
{
2024-07-31 09:14:07 +00:00
private readonly object Lock = new();
public void CreateLocalSyncServer(AbsPipeLine pipeLine,string name)
{
var server = new LocalSyncServer(pipeLine, this,name);
2024-07-31 09:14:07 +00:00
lock (Lock)
{
Servers.Add(server);
}
}
private readonly List<LocalSyncServer> Servers = [];
public void RemoveLocalSyncServer(LocalSyncServer server)
{
2024-07-31 09:14:07 +00:00
lock (Lock)
{
Servers.Remove(server);
}
}
public LocalSyncServer? GetServerByName(string name)
{
var it = Servers.Where(x=>x.Name== name).FirstOrDefault();
return it;
}
}