Welcome

Last updated on 15 June 2024.

This is the website of Frank Th. van de Ven. I am a Dutch software developer with over 25 years of full-time experience. I am specialized in creating line-of-business software using JavaScript, web frameworks with C# for the back-end Web API.

My current focus is on React, Svelte, Blazor and ASP.NET Core. I have good knowledge of SQL Server, Oracle, Azure, WPF and WinForms.

I developed a 3-tier SQL framework for C# projects (VenturaSQL), and a component framework for Blazor projects (Kenova). Source code for both are on GitHub. I am currently working on a JavaScript version of Kenova.

VenturaSQL 4 Web API

Starting with VenturaSQL version 4, the middleware is exposed as a Web API using an ASP.NET controller.

using VenturaSQL;
using VenturaSQL.AspNetCore.Server.RequestHandling;

namespace BlazorDemo.Server.Controllers
{
    [ApiController]
    [Authorize]
    public class VenturaSqlController : ControllerBase
    {
        [Route("api/venturasql")]
        [HttpPost]
        public async Task<IActionResult> Index(byte[] requestData)
        {

            var processor = new VenturaSqlServerEngine();
            processor.CallBacks.LookupAdoConnector = LookupAdoConnector;
            await processor.ExecAsync(requestData);
            Response.ContentType = "application/octet-stream";
            await Response.Body.WriteAsync(processor.ResponseBuffer, 0, processor.ResponseLength);
            return Ok();
        }

        private AdoConnector LookupAdoConnector(string requestedName)
        {
            if (requestedName == "DefaultConnector")
                return new AdoConnector(SqlClientFactory.Instance, "Server=tcp:sysdev-sqlserver-public.database.windows.net,1433;Initial Catalog=AdventureWorks2017;...");

            throw new Exception($"Requested connector name {requestedName} is unknown on server.");
        }
    }
}

In the C# code above, the requestData byte array is created by the recordsets on the client and transmitted to the server in binary format. The VenturaSqlServerEngine will perform the requested database operations and return the data to the client in binary format. The client then unpacks the data and fills the rows in the recordsets.