using BBWY.Common.Models; using BBWY.Server.Model; using System.Collections.Generic; using System.Linq; using Yitter.IdGenerator; namespace BBWY.Server.Business { public class BaseBusiness { protected IFreeSql fsql; protected NLogManager nLogManager; protected IIdGenerator idGenerator; protected IEnumerable platformSDKBusinessList; public BaseBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, IEnumerable platformSDKBusinessList) { this.fsql = fsql; this.nLogManager = nLogManager; this.idGenerator = idGenerator; this.platformSDKBusinessList = platformSDKBusinessList; } public PlatformSDKBusiness GetPlatformSDKBusiness(Enums.Platform platofrm) { var pb = platformSDKBusinessList.FirstOrDefault(p => p.Platform == platofrm); if (pb == null) throw new BusinessException($"不支持平台{platofrm}"); return pb; } } }