using BotSharp.Platform.Abstraction; using BotSharp.Platform.Models; using System; using System.Collections.Generic; using System.Text; namespace BotSharp.Core { public abstract class PlatformBuilderBase where TStorage : IAgentStorage, new () { protected static TStorage storage; public PlatformBuilderBase() { if (storage == null) storage = new TStorage(); } public List> GetAllAgents() { return storage.Query(); } public StandardAgent GetAgentById(string agentId) { return storage.FetchById(agentId); } public StandardAgent GetAgentByName(string agentName) { return storage.FetchByName(agentName); } public virtual bool SaveAgent(StandardAgent agent) { // default save agent in FileStorage storage.Persist(agent); return true; } } }