# accounting-companion/tallyconnector architecture

> Architecture diagram of the GitHub repository accounting-companion/tallyconnector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/accounting-companion/tallyconnector
- Repository: https://github.com/accounting-companion/tallyconnector

## Overview

TallyConnector is a C# client library for Tally’s XML API. The principal workflow is to configure a version-specific service, request accounting data through the abstract client, construct a Tally XML envelope, send it to Tally, then clean and deserialize the response into models. The repository also provides filtering/query metadata and source-generated TDL reports and helper methods. Relationships involving unsampled implementation details are omitted; the source-generator branch is included as a documented capability, with unverified wiring marked accordingly.

Main entry points: [`src/TallyConnector/Services/TallyAbstractClient.cs`](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyAbstractClient.cs) (Abstract Client), [`src/TallyConnector/Services/BaseTallyService.cs`](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/BaseTallyService.cs) (Base Service), [`src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/MetaDataGenerator.cs`](https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/MetaDataGenerator.cs) (TDL Metadata Generator), [`src/TallyConnector/Services/TallyPrime/V6/TallyPrimeService.cs`](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyPrime/V6/TallyPrimeService.cs) (Prime Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Client API"]
  node_prime["Prime Services"]
  node_client["Abstract Client"]
end

subgraph group_transport["XML Transport"]
  node_base["Base Service"]
  node_request["Request Envelope<br/>[RequestEnvelope.cs]"]
  node_response["Response Envelope"]
  node_cleaner["Response Cleaner"]
  node_parser["XML Deserializer<br/>[XMLToObject.cs]"]
end

subgraph group_domain["Accounting Domain"]
  node_models["Versioned Models<br/>[V6]"]
  node_filters["Filters<br/>[Filter.cs]"]
  node_metadata["Property Metadata"]
  node_metaobjects["Generated Metadata<br/>[MetaObject.cs]"]
  node_query["Query Builder<br/>[QueryBuilder.cs]"]
  node_license["License Data<br/>[LicenseInfo.cs]"]
end

subgraph group_generation["Code Generation"]
  node_generator["TDL Metadata Generator"]
  node_genmodels["Generator Data Models<br/>[Models]"]
  node_postdto["DTO Generation"]
  node_helpergen["Service Helpers"]
  node_analyzer["TDL Analyzer"]
end

node_app(("Application"))
node_tally["Tally XML API"]

node_app -->|"requests data"| node_prime
node_prime -->|"inherits"| node_client
node_client -->|"delegates requests"| node_base
node_client -->|"builds requests"| node_request
node_base -->|"serializes envelope"| node_request
node_base -->|"sends XML"| node_tally
node_tally -.->|"returns XML"| node_base
node_base -->|"deserializes response"| node_parser
node_client -.->|"cleans response"| node_cleaner
node_client -.->|"uses response envelope"| node_response
node_prime -.->|"returns domain objects"| node_models
node_client -->|"accepts filters"| node_filters
node_filters -->|"formats conditions"| node_metadata
node_query -->|"uses metadata"| node_metaobjects
node_client -->|"requests license data"| node_license
node_generator -->|"produces metadata"| node_genmodels
node_analyzer -.->|"triggers generation"| node_generator
node_generator -.->|"coordinates generation"| node_postdto
node_generator -.->|"supports helper generation"| node_helpergen

click node_prime "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyPrime/V6/TallyPrimeService.cs"
click node_client "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyAbstractClient.cs"
click node_base "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/BaseTallyService.cs"
click node_request "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/Models/Request/RequestEnvelope.cs"
click node_response "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/Models/Response/ResponseEnvelope.cs"
click node_cleaner "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyResponseCleaner.cs"
click node_parser "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/XMLToObject.cs"
click node_models "https://github.com/accounting-companion/tallyconnector/tree/master/src/TallyConnector.Models/TallyPrime/V6"
click node_filters "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Abstractions/Models/Filter.cs"
click node_metadata "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Abstractions/Models/PropertyMetaData.cs"
click node_metaobjects "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Abstractions/Models/MetaObject.cs"
click node_query "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/QueryBuilder.cs"
click node_license "https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/Models/LicenseInfo.cs"
click node_generator "https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/MetaDataGenerator.cs"
click node_genmodels "https://github.com/accounting-companion/tallyconnector/tree/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Models"
click node_postdto "https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/PostDTOGenerator.cs"
click node_helpergen "https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/ServiceHelperMethodGenerator.cs"
click node_analyzer "https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Analyzer/TDLReportAnalyzer.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prime,node_client toneBlue
class node_base,node_request,node_response,node_cleaner,node_parser toneAmber
class node_models,node_filters,node_metadata,node_metaobjects,node_query,node_license,node_tally toneMint
class node_generator,node_genmodels,node_postdto,node_helpergen,node_analyzer toneRose
class node_app toneIndigo
```

## Components

### Client API

- [Prime Services](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyPrime/V6/TallyPrimeService.cs): `src/TallyConnector/Services/TallyPrime/V6/TallyPrimeService.cs`
- [Abstract Client](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyAbstractClient.cs): `src/TallyConnector/Services/TallyAbstractClient.cs`

### XML Transport

- [Base Service](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/BaseTallyService.cs): `src/TallyConnector/Services/BaseTallyService.cs`
- [Request Envelope](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/Models/Request/RequestEnvelope.cs): `src/TallyConnector.Core/Models/Request/RequestEnvelope.cs`
- [Response Envelope](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/Models/Response/ResponseEnvelope.cs): `src/TallyConnector.Core/Models/Response/ResponseEnvelope.cs`
- [Response Cleaner](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/TallyResponseCleaner.cs): `src/TallyConnector/Services/TallyResponseCleaner.cs`
- [XML Deserializer](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector/Services/XMLToObject.cs): `src/TallyConnector/Services/XMLToObject.cs`

### Accounting Domain

- [Versioned Models](https://github.com/accounting-companion/tallyconnector/tree/master/src/TallyConnector.Models/TallyPrime/V6): `src/TallyConnector.Models/TallyPrime/V6`
- [Filters](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Abstractions/Models/Filter.cs): `src/TallyConnector.Abstractions/Models/Filter.cs`
- [Property Metadata](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Abstractions/Models/PropertyMetaData.cs): `src/TallyConnector.Abstractions/Models/PropertyMetaData.cs`
- [Generated Metadata](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Abstractions/Models/MetaObject.cs): `src/TallyConnector.Abstractions/Models/MetaObject.cs`
- [Query Builder](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/QueryBuilder.cs): `src/TallyConnector.Core/QueryBuilder.cs`
- [License Data](https://github.com/accounting-companion/tallyconnector/blob/master/src/TallyConnector.Core/Models/LicenseInfo.cs): `src/TallyConnector.Core/Models/LicenseInfo.cs`

### Code Generation

- [TDL Metadata Generator](https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/MetaDataGenerator.cs): `src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/MetaDataGenerator.cs`
- [Generator Data Models](https://github.com/accounting-companion/tallyconnector/tree/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Models): `src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Models`
- [DTO Generation](https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/PostDTOGenerator.cs): `src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/PostDTOGenerator.cs`
- [Service Helpers](https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/ServiceHelperMethodGenerator.cs): `src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/ServiceHelperMethodGenerator.cs`
- [TDL Analyzer](https://github.com/accounting-companion/tallyconnector/blob/master/src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Analyzer/TDLReportAnalyzer.cs): `src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Analyzer/TDLReportAnalyzer.cs`

### Other components

- **Application**
- **Tally XML API**

## Connections

- Application → Prime Services: requests data
- Prime Services → Abstract Client: inherits (evidence: `src/TallyConnector/Services/TallyPrime/V6/TallyPrimeService.cs`)
- Abstract Client → Base Service: delegates requests (evidence: `src/TallyConnector/Services/TallyAbstractClient.cs`)
- Abstract Client → Request Envelope: builds requests (evidence: `src/TallyConnector/Services/TallyAbstractClient.cs`)
- Base Service → Request Envelope: serializes envelope (evidence: `src/TallyConnector/Services/BaseTallyService.cs`)
- Base Service → Tally XML API: sends XML (evidence: `src/TallyConnector/Services/BaseTallyService.cs`)
- Tally XML API → Base Service: returns XML
- Base Service → XML Deserializer: deserializes response (evidence: `src/TallyConnector/Services/BaseTallyService.cs`)
- Abstract Client → Response Cleaner: cleans response (evidence: `src/TallyConnector/Services/TallyAbstractClient.cs`)
- Abstract Client → Response Envelope: uses response envelope (evidence: `src/TallyConnector/Services/TallyAbstractClient.cs`)
- Prime Services → Versioned Models: returns domain objects
- Abstract Client → Filters: accepts filters (evidence: `src/TallyConnector/Services/TallyAbstractClient.cs`)
- Filters → Property Metadata: formats conditions (evidence: `src/TallyConnector.Abstractions/Models/Filter.cs`)
- Query Builder → Generated Metadata: uses metadata (evidence: `src/TallyConnector.Core/QueryBuilder.cs`)
- Abstract Client → License Data: requests license data (evidence: `src/TallyConnector/Services/TallyAbstractClient.cs`)
- TDL Metadata Generator → Generator Data Models: produces metadata (evidence: `src/SourceGenerators/TallyConnector.TDLReportSourceGenerator/Services/MetaDataGenerator.cs`)
- TDL Analyzer → TDL Metadata Generator: triggers generation
- TDL Metadata Generator → DTO Generation: coordinates generation
- TDL Metadata Generator → Service Helpers: supports helper generation
