Exemplo n.º 1
0
            public Trigger(
                Identifier tableName,
                Identifier triggerName,
                string definition,
                TriggerQueryTiming queryTiming,
                TriggerEvent triggerEvent
                )
            {
                if (tableName == null)
                {
                    throw new ArgumentNullException(nameof(tableName));
                }
                if (triggerName == null)
                {
                    throw new ArgumentNullException(nameof(triggerName));
                }
                if (definition.IsNullOrWhiteSpace())
                {
                    throw new ArgumentNullException(nameof(definition));
                }

                TriggerName = triggerName.LocalName;
                Definition  = definition;

                TriggerUrl = "../" + UrlRouter.GetTriggerUrl(tableName, triggerName);

                var queryFlags = queryTiming.GetFlags()
                                 .Select(qt => TimingDescriptions[qt])
                                 .OrderBy(qt => qt)
                                 .ToList();
                var eventFlags = triggerEvent.GetFlags()
                                 .Select(te => EventDescriptions[te])
                                 .OrderBy(te => te)
                                 .ToList();

                QueryTiming = queryFlags.Join(", ");
                Events      = eventFlags.Join(", ");
            }
Exemplo n.º 2
0
        public Trigger(
            Identifier tableName,
            Identifier triggerName,
            string rootPath,
            string definition,
            TriggerQueryTiming queryTiming,
            TriggerEvent triggerEvent
            )
        {
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }
            if (triggerName == null)
            {
                throw new ArgumentNullException(nameof(triggerName));
            }

            Name       = triggerName.ToVisibleName();
            TableName  = tableName.ToVisibleName();
            TableUrl   = rootPath + UrlRouter.GetTableUrl(tableName);
            TriggerUrl = rootPath + UrlRouter.GetTriggerUrl(tableName, triggerName);
            RootPath   = rootPath ?? throw new ArgumentNullException(nameof(rootPath));
            Definition = definition ?? throw new ArgumentNullException(nameof(definition));

            var queryFlags = queryTiming.GetFlags()
                             .Select(qt => TimingDescriptions[qt])
                             .OrderBy(qt => qt)
                             .ToList();
            var eventFlags = triggerEvent.GetFlags()
                             .Select(te => EventDescriptions[te])
                             .OrderBy(te => te)
                             .ToList();

            QueryTiming = queryFlags.Join(", ");
            Events      = eventFlags.Join(", ");
        }