public BakingRightsRepository(AccountsCache accounts, ProtocolsCache protocols, TimeCache time, StateCache state, IConfiguration config) : base(config) { Accounts = accounts; Protocols = protocols; Time = time; State = state; }
/// <summary> /// 获取所有协议信息 /// </summary> /// <returns></returns> private static void GetProtocolsFullLoaded() { foreach (var protocol in ProcessInvoke.Instance <ProtocolCodingProcess>().GetProtocolsFullLoaded() .Where(protocol => !ProtocolsCache.ContainsValue(protocol))) { ProtocolsCache.Add(protocol.ProtocolName, protocol); } }
public CacheService(TzktContext db) { AppState = new AppStateCache(db); BakerCycles = new BakerCyclesCache(db); BakingRights = new BakingRightsCache(db); Accounts = new AccountsCache(this, db); Blocks = new BlocksCache(this, db); Periods = new PeriodsCache(db); Proposals = new ProposalsCache(db); Protocols = new ProtocolsCache(db); }
public CacheService(TzktContext db) { AppState = new AppStateCache(db); BakerCycles = new BakerCyclesCache(db); BakingRights = new BakingRightsCache(db); Accounts = new AccountsCache(this, db); Blocks = new BlocksCache(this, db); Periods = new PeriodsCache(db); Proposals = new ProposalsCache(db); Protocols = new ProtocolsCache(db); Statistics = new StatisticsCache(db); Software = new SoftwareCache(db); Schemas = new SchemasCache(db); Storages = new StoragesCache(db); }
/// <summary> /// 通过协议所属域获取协议集合 /// </summary> /// <param name="fieldName">协议所属域名称</param> /// <returns></returns> public static List <Protocol> GerProtocolsByField(string fieldName) { var protocolList = ProtocolsCache.Where(protocol => protocol.Value.SubField.ItemValue == fieldName) .Select(obj => obj.Value) .ToList(); if (protocolList.Count == 0) { protocolList = ProtocolsCache.Where(protocol => protocol.Value.Field.ItemValue == fieldName) .Select(obj => obj.Value) .ToList(); } return(protocolList); }
/// <summary> /// 通过协议名称获取协议 /// </summary> /// <param name="name"></param> /// <returns></returns> public static Protocol GetProtocolByName(string name) { if (ProtocolsCache.ContainsKey(name)) { return(ProtocolsCache[name]); } var protocol = ProcessInvoke.Instance <ProtocolCodingProcess>().GetProtocolFullLoadedByName(name); if (protocol == null) { return(null); } ProtocolsCache.Add(protocol.ProtocolName, protocol); return(ProtocolsCache[name]); }
/// <summary> /// 从协议缓存中获取指定ID的指令 /// </summary> /// <param name="commandGuid"></param> /// <returns></returns> public static ProtocolCommand GetCommand(Guid commandGuid) => ProtocolsCache.Select(protocol => protocol.Value.ProtocolCommands.FirstOrDefault(cmd => cmd.Id == commandGuid)) .FirstOrDefault(targetCommand => targetCommand != null);
public CyclesRepository(ProtocolsCache protocols, QuotesCache quotes, IConfiguration config) : base(config) { Protocols = protocols; Quotes = quotes; }