Пример #1
0
 internal BaseCommand(SchemaNavigator navigator, String from)
 {
     this.navigator  = navigator;
     this.rootEntity = navigator.GetEntity(from).ID;
     this.query      = new Query($"{navigator.GetEntity(from).DBName} as A0");
     commandId       = Helpers.Util.UCode();
     sw = new Stopwatch();
 }
Пример #2
0
        public static IList <StormResult> ToResults(StormDataSet data,
                                                    SchemaNavigator navigator,
                                                    List <Origin> requests,
                                                    OriginTree fromTree)
        {
            var root        = navigator.GetEntity(data.root);
            var ranges      = data.ObjectRanges;
            var primaryKeys = data.IdentityIndexes;
            var items       = new Dictionary <EntityPath, Dictionary <object, StormResult> >();
            var results     = new List <StormResult>();

            for (int i = 0; i < data.Count(); i++)
            {
                var ctx = new RecCtx()
                {
                    Data        = data,
                    Index       = i,
                    PrimaryKeys = primaryKeys,
                    Ranges      = ranges,
                    Root        = root
                };

                var(pk, r) = CreateResult(fromTree.root, ctx);

                if (!results.Any(x => x.PrimaryKey == pk))
                {
                    results.Add(r);
                }

                r = results.First(x => x.PrimaryKey == pk);
                CreateResultRelations(ctx, requests.Where(x => x.FullPath != fromTree.root.FullPath).ToList(), r);
            }

            return(results);
        }
Пример #3
0
        internal DeleteCommand(SchemaNavigator navigator, String from) : base(navigator, from)
        {
            this.from = new OriginTree()
            {
                navigator = navigator,
                root      = new Origin()
                {
                    Alias    = "",
                    FullPath = new EntityPath(from, ""),
                    Edge     = null,
                    Entity   = navigator.GetEntity(from),
                    children = new List <Origin>()
                }
            };

            ((BaseCommand)this).CommandLog(LogLevel.Info, "DeleteCommand", $"{{\"Action\":\"Delete\", \"Entity\":\"{from}\"}}");
        }
Пример #4
0
 internal SetCommand(SchemaNavigator navigator, String from, Object id) : base(navigator, from)
 {
     this.id = id;
     entity  = navigator.GetEntity(this.rootEntity);
     ((BaseCommand)this).CommandLog(LogLevel.Info, "SetCommand", $"{{\"Action\":\"Insert\", \"Entity\":\"{from}\"}}");
 }
Пример #5
0
 internal SetCommand(SchemaNavigator navigator, String from) : base(navigator, from)
 {
     entity = navigator.GetEntity(this.rootEntity);
     ((BaseCommand)this).CommandLog(LogLevel.Info, "SetCommand", $"{{\"Action\":\"Update\", \"Entity\":\"{from}\"}}");
 }