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);
        }
Ejemplo n.º 2
0
        public async Task <string> GenerateSql(DatabaseTableSolutionItem item)
        {
            IDatabaseTableData?tableData = await LoadTable(item);

            if (tableData == null)
            {
                return($"-- Unable to load data for {item} from the database");
            }

            item.UpdateEntitiesWithOriginalValues(tableData.Entities);
            return(queryGenerator.GenerateQuery(item.Entries.Select(e => e.Key).ToList(), tableData));
        }
Ejemplo n.º 3
0
        private void ExecuteSql(EventRequestGenerateSqlArgs args)
        {
            if (args.Item is not DatabaseTableSolutionItem dbEditItem)
            {
                return;
            }

            if (!SolutionItem.Equals(dbEditItem))
            {
                return;
            }

            args.Sql = queryGenerator.GenerateQuery(GenerateKeys(), new DatabaseTableData(tableDefinition, Entities));
        }
 public virtual Task <IQuery> GenerateQuery()
 {
     return(Task.FromResult(queryGenerator
                            .GenerateQuery(GenerateKeys(), GenerateDeletedKeys(), new DatabaseTableData(tableDefinition, Entities))));
 }
Ejemplo n.º 5
0
 public Task <string> GenerateQuery()
 {
     return(Task.FromResult(queryGenerator
                            .GenerateQuery(GenerateKeys(), new DatabaseTableData(tableDefinition, Entities)).QueryString));
 }