The small window you are using greatly diminishes your demo experience. Please consider viewing using a larger window.

Behind The Scenes Explanation

This is where you get to see what's happening behind the scenes when you interact with the site on the left side.

The view consists of three (collapsible) parts...

1. Full Code, Queries, And Results

The server handles the web requests that are the result of you interacting with the site.
In doing so, the demo backend code is executed which in turn uses WYSE.

The relevant/notable methods taking part in that process are shown in the first vertical tab.
Basically you are seeing a (partial) stack trace.
It is tree structure of which the nodes are collapsible/expandable for your browsing convenience.

The leaves of the STACK TRACE TREE are where interaction with the database takes place.
That is generally where you will find the generated SQL statements and the JSON of the converted database results.

2. Queries And Results Only

A filtered list of entries where only the database queries and results are shown.

3. API Results

If applicable: this shows the JSON of the call to the server as if it had been an API call.

  • Trace Entries: 2
      ...Trekkitopia.Controllers.ProductController.Index:
      [HttpGet]
      public ViewResult Index()
      {
          var traceTree = _traceTreesRepository.Record();
          traceTree.RecordCodeMethodExecution(MethodBase.GetCurrentMethod());
      
          var products = _shopService.GetProducts(traceTree);
          var productModels = _productMapper.Convert(products);
      
          return View(new IndexModel(productModels, _traceTreesRepository.RootTraceTree));
      }
    • Trace Entries: 2
        ...Trekkitopia.Business.ShopService.GetProducts:
        public IReadOnlyList<Product> GetProducts(TraceTree parentTraceTree)
        {
            var traceTree = parentTraceTree.AddChild();
            traceTree.RecordCodeMethodExecution(MethodBase.GetCurrentMethod());
        
            var productTable = new ProductTable();
        
            Select select = new /*WYSE*/Select()
                .Columns(productTable)
                .From(productTable)
                .OrderBy(productTable.Name);
        
            return _sqlExecuter.GetItems(select, productTable.Convert, traceTree);
        }
      • Trace Entries: 2
          ...Trekkitopia.DatabaseAccess.SqlExecuter.GetItems:
          public IReadOnlyList<TItem> GetItems<TItem>(
              /*WYSE*/ISelect select,
              Converter<DbDataReader, TItem> converter,
              TraceTree parentTraceTree)
          {
              var traceTree = parentTraceTree.AddChild();
              traceTree.RecordCodeMethodExecution(MethodBase.GetCurrentMethod());
          
              return Get<IReadOnlyList<TItem>>(
                  select,
                  reader => reader./*WYSE*/GetItems(select, converter).ToList(),
                  traceTree);
          }
        • Trace Entries: 2
            ...Trekkitopia.DatabaseAccess.SqlExecuter.Get:
            private TItem Get<TItem>(
                /*WYSE*/IExecutable executable,
                Func<DbDataReader, TItem> getResult,
                TraceTree parentTraceTree)
            {
                var traceTree = parentTraceTree.AddChild();
                traceTree.RecordCodeMethodExecution(MethodBase.GetCurrentMethod());
            
                using MySqlConnection connection = _connectionFactory.Create();
                connection.Open();
            
                // Aliases and parameter names can be given custom values.
                // If omitted, unique identifer values are supplied
                // In the case of this Demo, these generated values are overwritten,
                // based on the current render settings, with more legible values.
                // WYSE supports several kinds of Resetting/renaming.
                ResetIdentifiers(executable);
            
                using MySqlCommand command = connection.CreateCommand()
                    // A WYSE Render context determines certain (overridable) render settings.
                    // Here the context is MySql. More SQL flavors are supported.
                    // A WYSE render builder is used for stringifying
                    // the strongly typed SQL statements.
                    /*WYSE*/.For(executable, _renderContextFactory.Create(), _createRenderBuilder);
            
                try
                {
                    using DbDataReader reader = command.ExecuteReader();
            
                    var result = getResult(reader);
            
                    traceTree.RecordDbCommandExecutionSuccess(
                        command.CommandText,
                        command.Parameters.ToDictionary(),
                        result);
            
                    return result;
                }
                catch (Exception exception)
                {
                    traceTree.RecordDbCommandExecutionFailure(
                        command.CommandText,
                        command.Parameters.ToDictionary(),
                        exception);
            
                    return default;
                }
            }

            Command Text:

            SELECT
                `product`.`name` `product_name`,
                `product`.`description` `product_description`,
                `product`.`price` `product_price`,
                `product`.`photoid` `product_photoid`,
                `product`.`id` `product_id`
            FROM `product` `product`
            ORDER BY `product`.`name` ASC

Command Text:

SELECT
    `product`.`name` `product_name`,
    `product`.`description` `product_description`,
    `product`.`price` `product_price`,
    `product`.`photoid` `product_photoid`,
    `product`.`id` `product_id`
FROM `product` `product`
ORDER BY `product`.`name` ASC