public bool SaveQuery(string path)
        {
            var fileName   = GenerateFileName(path);
            var parameters = new StorageParameters {
                FileName = fileName
            };
            var query = GenerateQuery();

            if (query == null)
            {
                return(false);
            }

            _storage.SaveQuery(query, parameters);

            LinqQuery = "";
            SqlQuery  = "";

            if (!ValidationResults.Any())
            {
                var schemaFileName = Path.Combine(path, $"Schema.json");
                LinqQuery = _linqGenerator.GenerateQuery(schemaFileName, fileName);
            }

            return(true);
        }
        public void LoadFromFile(string path, string fileName)
        {
            var parameters = new StorageParameters {
                FileName = fileName, Path = path
            };
            var q = _storage.LoadQuery(parameters);

            Clear();
            var queryModel = _engine.LoadFromStoreQuery(this, q);

            StoreParameters = queryModel.StoreParameters;
            FromTables      = queryModel.FromTables;
            RegenerateTableLinks();
            SelectionProperties = queryModel.SelectionProperties;

            foreach (var sp in SelectionProperties)
            {
                // var t = FindFromTable(sp.);
                var prop = sp.FromTable.Properties.SingleOrDefault(p => p.StoreProperty.Name == sp.StoreProperty.Name);

                if (prop != null)
                {
                    prop.Selected = true;
                }
            }

            WhereClause = queryModel.WhereClause;
        }
        public void SaveSchema(string path)
        {
            var fileName   = Path.Combine(path, $"Schema.json");
            var parameters = new StorageParameters {
                FileName = fileName
            };

            _storage.SaveSchema(Schema, parameters);
        }
        public void SaveQuery(string path)
        {
            var fileName   = GenerateFileName(path);
            var parameters = new StorageParameters {
                FileName = fileName
            };
            var query = GenerateQuery();

            _storage.SaveQuery(query, parameters);
        }
        public void LoadFromFile(string path, string fileName)
        {
            var parameters = new StorageParameters {
                FileName = fileName, Path = path
            };
            var q = _storage.LoadQuery(parameters);

            Clear();
            var fullQuery = _engine.LoadQueryFromStoreQuery(Schema, q);

            ReloadControllerModels(fullQuery);
        }