Пример #1
0
    protected DistributedShell()
    {
        var resetComposer =
            new ShellComposer
        {
            new ShellComponent(
                "soft",
                (expr, session) =>
            {
                var dist = Parsing.DistributedQuery(ref expr, session.Client);
                var rng  = Parsing.Range(ref expr, session.Client) ?? DateFilter.Unconstrained;
                Parsing.Eof(expr);
                return(ExecuteResetSoft(dist, rng, session));
            }),
            new ShellComponent(
                "mixed",
                (expr, session) =>
            {
                var dist = Parsing.DistributedQuery(ref expr, session.Client);
                var rng  = Parsing.Range(ref expr, session.Client) ?? DateFilter.Unconstrained;
                Parsing.Eof(expr);
                return(ExecuteResetMixed(dist, rng, session));
            }),
            new ShellComponent(
                "hard",
                (expr, session) =>
            {
                var dist     = Parsing.DistributedQuery(ref expr, session.Client);
                var vouchers = Parsing.OptColVouchers(ref expr, session.Client);
                Parsing.Eof(expr);
                return(ExecuteResetHard(dist, vouchers, session));
            }),
        };

        m_Composer =
            new ShellComposer
        {
            new ShellComponent(
                "all",
                (expr, session) =>
            {
                var safe = Parsing.Token(ref expr, false, static t => t == "unsafe") == null;
                var dist = Parsing.DistributedQuery(ref expr, session.Client);
                Parsing.Eof(expr);
                if (dist.IsDangerous() && safe)
                {
                    throw new SecurityException("检测到弱检索式");
                }

                return(ExecuteList(dist, null, false, session));
            }),
Пример #2
0
 public Facade(string uri = null, string db = null)
 {
     m_Db = new(uri, db);
     m_AccountingShell = new();
     m_ExchangeShell   = new();
     m_Composer        =
         new()
     {
         new CheckShell(),
         new CarryShell(),
         m_ExchangeShell,
         new AssetShell(),
         new AmortizationShell(),
         new PluginShell(),
         m_AccountingShell,
     };
 }