namespace Yw { /// /// 调用入口 /// public sealed partial class BIMFaceClient { /// /// 获取BimfaceClient对象 /// public static BIMFaceClient Instance(string appKey, string appSecret) { var client = _clients.Find(x => x.AppKey == appKey && x.AppSecret == appSecret); if (client == null) { lock (_locker) { client = _clients.Find(x => x.AppKey == appKey && x.AppSecret == appSecret); if (client == null) { client = new BIMFaceClient(appKey, appSecret); _clients.Add(client); } } } return client; } //私有构造函数 private BIMFaceClient(string AppKey, string AppSecret) { _appKey = AppKey; _appSecret = AppSecret; } /// /// AppKey /// public string AppKey { get => _appKey; } private string _appKey; /// /// AppSecret /// public string AppSecret { get => _appSecret; } private string _appSecret; private static object _locker = new();//锁对象 private static List _clients = new();//client 列表 } }