Net-Base Magazine

07.06.2026

C# and Delphi in a unified architecture: pragmatic integration instead of either-or

Many companies operate long-established Delphi desktop applications and are building new C# services and portals in parallel. This article shows how C# and Delphi integrate cleanly within a shared architecture: through clear layers, stable interfaces, shared...

07.06.2026

From magazine topic to project implementation

Relevant service and technical pages for this post

In many IT departments the starting point is similar: a stable, process‑centric Delphi desktop application carries critical workflows, while new requirements push toward the web, portals, mobile use and integration with cloud services. At the same time C# is established in many companies when it comes to services, web APIs and identity integration. The central question is therefore no longer „Delphi or C#?“, but: to combine C# and Delphi in a shared architecture so that operation, maintenance, data management and security remain manageable.

This article describes practical architectural principles that prove effective in enterprise environments where not everything can or should be rebuilt. The focus is on clear responsibilities between desktop client, services, data and interfaces – and on how to plan modernization steps with low risk, without endangering ongoing processes.

Why mixed stacks are normal in enterprises

Evolved digital enterprise solutions rarely start from a greenfield. Delphi applications have often been extended over many years, close to the business processes, with extensive data logic and deep know‑how about special cases. In parallel new requirements have emerged: self‑service portals, automated data exchanges, integration of DMS/CRM/ERP, multi‑tenancy, stronger auditability or single sign‑on.

C# often offers advantages in this context for web and service ecosystems: a broad hosting spectrum, standardized middleware, good integration with identity providers and established patterns for web APIs. Delphi remains strong, however, when it comes to performant Windows desktop clients, long‑term maintained VCL applications or specific multiplatform clients (e.g. via FMX).

The mix is therefore not a „special case“ but a realistic response to investment protection and modernization pressure. Crucial is that joint operation does not become a perpetual maintenance burden.

Architectural principle: clear layers instead of language boundaries

When two languages come together, there is a strong temptation to organise separation along technology („Everything Delphi is legacy, everything C# is new“). Technically that often works in the short term, but it leads to friction in the long term: duplicated business rules, unclear responsibilities and hard‑to‑reproduce errors.

Instead, a domain‑based layering has proven effective, often implemented as a Layer-3 Architektur: presentation (UI), domain (business logic) and infrastructure (data access, external systems). The point is less the textbook model than the concrete effect in daily operations: decisions about data, validations and workflows are made in one place and exposed via stable interfaces.

In a mixed architecture that means in practice: Delphi can continue to provide a UI component (or certain workflows), while C# services encapsulate a domain layer – or vice versa. What matters is that the edge between the layers is technically clean and testable.

C# and Delphi in a shared architecture: three proven integration patterns

For coupling Delphi and C# there is not a single „right“ way. Good decisions are guided by operations, security requirements, latency, data volume and release cycles. In practice three patterns have emerged.

1) Service orientation over HTTP/REST as the standard integration

Often the most robust approach for operation and further development is coupling via REST-APIs (HTTP-based interfaces). Delphi clients invoke C# or Delphi services; C# portals use the same endpoints. This decoupling makes releases more predictable: a client update is not necessarily required if the API remains backward compatible.

Professional implementation matters: timeouts, retries, idempotence (repeated requests without side effects), clear error codes and a versioning strategy. For administration and operations also count: consistent logs, traceable request IDs and well-measurable response times.

2) Shared database: only with clear rules

Shared database access by Delphi and C# can be tempting because it is quick at the start. In the long term it is risky if both domains write directly to the same set of tables. The reason: business rules migrate into triggers, stored procedures or „somewhere in the client“. That complicates error analysis and audits.

If a shared database is unavoidable (e.g., during transitional phases), clear rules help:

  • Centralize write access: one system is the „System of Record“ for specific entities.
  • Define contracts: use views or APIs as a stable read layer instead of direct table access.
  • Plan migration windows: roll out database changes always backwards-compatible (e.g., introduce new columns as optional first).

Technically the database then becomes an infrastructure component, not the integration bus.

3) Messaging/Events for asynchronous processes

For decoupled flows (e.g., import runs, notifications, post-processing, interface jobs) an asynchronous model makes sense: one system publishes events, another processes them. This reduces direct dependencies and smooths load spikes.

For IT management and admins the important aspects are: monitoring (queue lengths), dead-letter handling (failed messages), restart/retry behavior and clear domain-level idempotence. Events are not a substitute for disciplined master data management, but they are a useful tool for robust process chains.

Data contracts and compatibility: the often underestimated core

Independent of the integration pattern, the quality of data contracts determines stability. A data contract is the binding description of fields, types, required/optional and semantics. In REST-APIs this is typically JSON; the important point is not „JSON itself“ but the discipline in handling changes.

Proven rules that noticeably simplify operations:

  • Extend rather than break: add new fields, continue to provide old ones initially.
  • Document field semantics: not just „string“, but e.g. ISO date, timezone, permitted states.
  • Treat enum values tolerant: clients must survive unknown values (forward compatibility).
  • Apply API versioning deliberately: not every release needs a new version; breaking changes must be explicitly encapsulated.

These points are particularly important when Delphi-desktop clients cannot be updated as frequently as web services.

Authentication and Authorization: a unified security model

Mixed architectures rarely fail due to „technology“; more often because of inconsistent security. For enterprises the questions are: who is allowed to do what? How is that verified? How is it audited? A unified model avoids duplicate user management and conflicting roles.

In practice this leads to a central identity layer: for example via SAML 2.0 (federated single sign-on, common in the enterprise) or OpenID Connect (OAuth2-based, often for modern web APIs). C#-services can usually be connected directly to an identity provider; Delphi-clients can obtain tokens and send them with API calls. It is important that desktop applications do not receive „special rights“ via direct database access.

Central for administrators:

  • Token lifetimes and refresh strategy (so clients run stably while remaining secure)
  • Service-to-service authentication for internal communication (e.g. mTLS or signed tokens)
  • Least privilege: avoid overly coarse-grained roles and permissions
  • Audit logs: record security-relevant actions for traceability

Operational concepts: Windows- and Linux-services, IIS and day-to-day processes

An architecture is only „good“ in an enterprise if it is operable: updates are schedulable, faults locatable, load controllable. In mixed landscapes the most common operating variants are:

  • Windows- and Linux-services: suitable for background jobs, integration runs, workers; well integrable into classic Windows server operating models.
  • Windows- and Linux-services/daemon: appropriate for containerized or VM-based operating models; often stable in long-running operation, with good automation via systemd.
  • Microsoft IIS: established hosting for web applications and reverse-proxy scenarios in Windows-centric environments.

It is important that Delphi- and C#-components meet similar operational standards: consistent health endpoints (liveness probes), defined timeouts, limited resource consumption, and a clear deployment and rollback procedure. That reduces „technology-specific“ special handling.

Logging, Tracing and Metrics: a common observability level

Especially with two technology stacks, end-to-end diagnostic chains are crucial. A typical problem: the Delphi-client reports „error saving“, the C#-service has a timeout, the database reports locks – without a shared context.

Practices that have proven effective are:

  • Correlation IDs per request (Client → API → DB), so logs can be correlated.
  • Structured logging (key/value rather than plain text lines), to enable later filtering.
  • Metrics for latency, error rates, queue lengths and resource usage.
  • Error classification: business errors (validation) separated from technical errors (timeout, network).

These fundamentals save more time in practice than any discussion about „the right language“.

Data access and migration: BDE-replacement, FireDAC and modern databases

In Delphi installations, data access has historically been a major concern. Where legacy access paths such as the Borland Database Engine (BDE) are still in use, additional pressure arises: operating system updates, 64‑bit migrations, driver availability, security requirements. A BDE-replacement then becomes not just modernization, but risk reduction.

A typical move is a BDE-replacement with native connectivity (a modern data access layer in Delphi), combined with a database that is operationally manageable (e.g. PostgreSQL, SQL Server, MariaDB). For a combined Delphi/C# architecture two aspects are important:

  • Transaction boundaries: Who starts/commits transactions, and how are parallel write accesses managed?
  • Locking and isolation strategy: to prevent desktop workflows and services from blocking one another.

For migrations a staged plan proves effective: first modernize the driver and access layer, then consolidate the data model, and finally stabilize integration interfaces. This makes error sources isolatable and rollbacks realistic.

Release management: harmonizing differing update cycles

A recurring point of tension is update frequency: web services can be rolled out more frequently, desktop clients often less so (rollout windows, user communication, packaging). A shared architecture must account for this asymmetry.

Practical consequences:

  • API backward compatibility is mandatory, not optional.
  • Feature Flags (functional switches) help to enable new functions server-side in a controlled way.
  • Schema migrations must run in phases: extend the database first, then have the service use it, then bring the client in line.
  • Clear deprecation: remove old endpoints or fields only after a defined period.

Especially in regulated environments it is important to fix these rules in writing as architectural guardrails, so decisions are not reinvented on a per-project basis.

Common pitfalls and how to avoid them systematically

From an operational perspective the most frequent problems in mixed Delphi/C# landscapes are highly predictable. If addressed early, long-term costs decline noticeably.

Pitfall 1: duplicate business logic

When a Delphi client and a C# service implement the same rules differently, „ghost errors“ appear: a process works in the UI but fails during API import. Countermeasure: centralize rules in the domain layer (service) or assign them clearly by domain, including unambiguous validation responses.

Pitfall 2: UI workarounds instead of clean interfaces

„Quickly writing another database field“ may seem harmless in an individual case, but it creates shadow interfaces without logging, authentication and versioning. Better: consistently use defined endpoints, even if that initially requires more discipline.

Pitfall 3: unclear responsibilities in operations

If it is not clear which team is responsible for which service, which log and which operational parameters, troubleshooting ends up as ping-pong. In practice a service map (which service, which dependencies, which ports, which internal SLAs) and standardized runbooks for common incidents help.

Pitfall 4: inconsistent security

A portal with SSO but a desktop client with local admin accounts is a problem in many audits. A common identity and role model reduces risk and support effort.

Decision guide: What stays in Delphi, what moves to C#?

The sensible split depends less on ideology than on process proximity and operational requirements. As guidance from an architecture and operations perspective:

  • Delphi is often a good fit for: existing Windows-desktop clients (VCL), very responsive UI workflows, scenarios close to offline operation, long-term maintenance of matured user interfaces.
  • C# is often a good fit for: central REST APIs, integration services for ERP/DMS/CRM, identity-related components, portals and backend processes with a high rate of change.
  • Decide deliberately: data logic and validation should not reside “in the client” when multiple frontends exist (desktop, portal, import jobs).

Important: the goal is not “everything to C#”, but a robust overall architecture in which modernization steps can be planned and business processes run reliably.

Modernization path: stepwise from the application to the system

In practice a shared architecture is often a transition, but a long one. A realistic modernization path avoids large, high-risk projects and focuses on measurable intermediate goals:

  1. Stabilize interfaces: introduce the REST API as the functional boundary, even if internally not everything is „clean“ yet.
  2. Modernize data access: BDE-replacement, drivers, 64-bit capability, clear transactions.
  3. Centralize identity: SSO and a role model for all access paths.
  4. Unify operations: logging/monitoring/health, clear deployments, reproducible environments.
  5. Decouple functional modules: move particularly change-intensive parts into services, progressively streamline the UI.

This sequence is not dogmatic, but it typically minimizes dependencies: without stable interfaces and an operations concept every further change becomes more expensive.

Conclusion: integration is an architectural task, not a language question

A viable combination of Delphi and C# does not arise from “bridge libraries”, but from clear functional boundaries, clean data contracts and an operations concept that takes monitoring, security and release management seriously. When C# and Delphi consciously play together within a shared architecture along lines of responsibility, companies gain above all one thing: modernization without process disruption. Delphi can continue to reliably carry stable desktop workflows, while C# services provide integration, web APIs and portals as central platform functions.

If you want to gradually modernize an existing Delphi landscape or cleanly integrate C# services, an architecture review with a focus on interfaces, data, operations and security is the fastest way to sound decisions. More on this through direct exchange:

In the functional context, Delphi modernization and REST-API for existing software also play an important role when integrations, data flows and further development must work together cleanly.

Discuss a project or modernization initiative with Net-Base.

Next step

When the topic becomes a real project, architecture, the existing system landscape and operations should be considered together early on.

We support not only with individual issues, but also when source snippets, legacy topics, or portal ideas are to be turned into a robust enterprise project.

  • Current state, target state and technical risks are assessed jointly.
  • REST, data access, portals and rollout are not deferred as afterthoughts.
  • You can determine early which path is economically and operationally viable.

Share post

Share this post directly

LinkedIn, X, XING, Facebook, WhatsApp and email are available immediately. For Instagram, we will prepare the link and a short caption immediately.

Email

Instagram opens in a new tab. The link and short text are copied to the clipboard beforehand.