-
Notifications
You must be signed in to change notification settings - Fork 7
ROU-12538: Improving .NET extension #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
1da710e
Make recCache dictionary thread safe
rugoncalves f6b791d
Removing unneeded dependencies
rugoncalves 531f995
Improving code performance
rugoncalves 53f2c7f
Project context
rugoncalves 7992c45
Missing namespace
rugoncalves 165e271
Update version of dotnet
rugoncalves aea00d3
Fix method name
rugoncalves f56ecfd
Fixing implementation errors
rugoncalves 28d4546
Re-adding namespace
rugoncalves fb84818
auto added namspaces
rugoncalves f67c766
Update .gitignore
rugoncalves 3636b99
Auto updated template
rugoncalves a0fad12
Update .gitignore
rugoncalves 25bc4a2
Update version
rugoncalves 2a36a62
Update OutSystems.NssDataGridUtils.xml
rugoncalves 653ad12
Update DataGridUtils.xif
rugoncalves b668fde
Making code more robust
rugoncalves 99c5fc1
Update DataGridUtils.xif
rugoncalves 33c41c4
Update .cursor/rules/project-context.mdc
rugoncalves 3c79189
Fix a bug that caused the metadata be empty
rugoncalves 063ed33
Changing check for field
rugoncalves b8a4ae1
Removing files from git
rugoncalves 7db87ca
Adding unit test project
rugoncalves 7e8b30a
Change extension to latest version
rugoncalves 8a36b22
Update .gitignore
rugoncalves 502555d
Update project information
rugoncalves dc2e12f
Updating comment for clear understanding
rugoncalves ff1e4d2
Adding ADR folder
rugoncalves 455c1ca
Adding ADR for the changes made
rugoncalves 98b9205
Improving test names
rugoncalves File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| description: Project context for the OutSystems DataGrid extension (.NET server-side code) | ||
| globs: extension/**/*.cs | ||
| alwaysApply: false | ||
| --- | ||
|
|
||
| # DataGridUtils .NET Extension | ||
|
|
||
| OutSystems Integration Studio extension (assembly `OutSystems.NssDataGridUtils`) that converts OutSystems platform objects (entities, structures, records, lists) into JSON for the front-end Data Grid component. | ||
|
|
||
| ## Directory Layout | ||
|
|
||
| - `extension/DataGridUtils/Templates/NET/` — Auto-generated stubs from Integration Studio (do not edit). | ||
| - `extension/DataGridUtils/Source/NET/` — Actual implementation (edit here). | ||
| - `extension/tests/` — Standalone test project (`DataGridUtils.Tests.csproj`). | ||
|
|
||
| ## Key Files (under `Source/NET/`) | ||
|
|
||
| | File | Role | | ||
| |---|---| | ||
| | `Interface.cs` | `IssDataGridUtils` — public API with `MssConvertData2JSON` and deprecated `MssConvertData2JSON_deprecated` | | ||
| | `DataGridUtils.cs` | `CssDataGridUtils` — implementation; bundles data + metadata into `{"data": ..., "metadata": ...}` | | ||
| | `ObtainMetadata.cs` | Reflection-based schema extractor; walks fields/properties prefixed with `ss` to produce a JSON type map | | ||
| | `temp_ardoJSON.cs` | Forked `ardoJSON` serializer; reflection + caching (`recCache`), smart ISO 8601 dates, list flattening, `Byte[]` exclusion | | ||
| | `Structures.cs`, `Records.cs`, `RecordLists.cs`, `Entities.cs` | Empty namespace placeholders from Integration Studio | | ||
|
|
||
| ## Test Project (`extension/tests/`) | ||
|
|
||
| A .NET Framework 4.7.2 console app that tests the extension without the OutSystems platform. | ||
|
|
||
| | File | Role | | ||
| |---|---| | ||
| | `DataGridUtils.Tests.csproj` | Project file; references the compiled extension DLL and platform DLLs from `Source/NET/Bin/` | | ||
| | `ConvertData2JSONTests.cs` | Tests for `MssConvertData2JSON`; contains mock OutSystems types (`ISimpleRecord`, `IRecord`, `IOSList`) and a lightweight pass/fail console runner | | ||
|
|
||
| - **Mock types** — `STCenasListStructure`, `RCCenasListRecord`, `RLCenasListRecordList` replicate the OutSystems record-list hierarchy so `CssDataGridUtils` can be exercised in isolation. | ||
| - **Runner pattern** — `RunTest(name, Action)` catches exceptions; `AssertEqual` provides positional diff on failure. Exit code 1 on any failure. | ||
|
|
||
| ## Conventions | ||
|
|
||
| - OutSystems runtime objects prefix fields/properties with `ss` (simple), `ssEN` (entity), `ssST` (structure). The code strips these prefixes when writing JSON keys. | ||
| - `Byte[]` fields are excluded from both data and metadata (ticket RGRIDT-364). | ||
| - DateTime handling (format `3` — smart ISO 8601): `1900-01-01 00:00:00` → `""`, date-only → `yyyy-MM-dd`, time-only → `HH:mm:ss`, full → UTC `yyyy-MM-dd'T'HH:mm:ssZ`. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - .NET Framework 4.7.2 | ||
| - Newtonsoft.Json 6.0 (from OutSystems Dev Environment) | ||
| - OutSystems.HubEdition.RuntimePlatform (`IRecord`, `ISimpleRecord`, `IOSList`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <!-- This is an ADR template, follow the same convention for future ADRs --> | ||
|
|
||
| # ADR-0000: Title of ADR | ||
|
|
||
| ## Status | ||
|
|
||
| Proposed/Accepted/Rejected/Superseded by ADR-XXXX | ||
|
|
||
| ## Context | ||
|
|
||
| What is the issue that we're seeing that is motivating this decision or change? | ||
| What is the current architectural state relevant to this decision? | ||
| What are the constraints (technical, business, etc.)? | ||
|
|
||
| ## Decision Drivers | ||
|
|
||
| - Driver 1 | ||
| - Driver 2 | ||
| - ... | ||
|
|
||
| ## Considered Options | ||
|
|
||
| - Option 1 | ||
| - Pros: | ||
| - Cons: | ||
| - Option 2 | ||
| - Pros: | ||
| - Cons: | ||
| - ... | ||
|
|
||
| ## Decision Outcome | ||
|
|
||
| Chosen option: "Option X", because [justification. e.g., only option that meets k.o. criteria decision driver | satisfies critical requirement | ... | comes out best (see below)]. | ||
| Positive consequences: | ||
|
|
||
| - ... | ||
| Negative consequences: | ||
| - ... | ||
|
|
||
| ## Links | ||
|
|
||
| - Link to related issues, discussions, or documents. | ||
|
|
||
| ## Date | ||
|
|
||
| YYYY-MM-DD |
52 changes: 52 additions & 0 deletions
52
docs/adr/ADR-0001-Extension-Dotnet-Upgrade-And-Improvements.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # ADR-0001: Extension .NET Upgrade and Improvements | ||
|
|
||
| ## Status | ||
|
|
||
| Accepted | ||
|
|
||
| ## Context | ||
|
|
||
| The DataGridUtils extension (`OutSystems.NssDataGridUtils`) was targeting an older .NET Framework version. The reflection-based JSON serializer (`temp_ardoJSON`) used a non-thread-safe `Dictionary<Type, ...>` for its type cache (`recCache`), which could cause thread deadlocks under concurrent access on the OutSystems platform. Additionally, the extension had no automated tests, making it difficult to validate changes without deploying to the platform. | ||
|
|
||
| ## Decision Drivers | ||
|
|
||
| - The OutSystems platform runtime uses .NET Framework 4.7.2, so updating from the outdated and unsupported 4.6.1 can be done safely. | ||
| - The `recCache` static dictionary was susceptible to deadlocks when accessed concurrently by multiple threads handling parallel requests, potentially causing data corruption and high usage of CPU - but the occurence of this is minimal. | ||
| - There was no way to test the extension logic in isolation without the OutSystems platform, slowing down development and increasing the risk of regressions. | ||
|
|
||
| ## Considered Options | ||
|
|
||
| - Option 1: Upgrade .NET version only | ||
| - Pros: Minimal change, low risk. | ||
| - Cons: Does not address thread safety or testability. | ||
| - Option 2: Upgrade .NET version + fix thread safety + add test project | ||
| - Pros: Addresses all the concerns of the RPM-6484. | ||
| - Cons: Larger changeset, but changes are isolated to the extension layer. | ||
| - Option 3: Upgrade .NET version + fix thread safety + add test project | ||
| - Pros: Addresses all three concerns in a single effort; the test project enables validating the thread-safety fix and future changes without the platform. | ||
| - Cons: Larger changeset, but changes are isolated to the extension layer. | ||
|
|
||
| ## Decision Outcome | ||
|
|
||
| Chosen option: "Option 3", because it addresses all identified issues together, and the test project provides confidence that the thread-safety and serialization fixes work correctly. | ||
|
|
||
| Positive consequences: | ||
|
|
||
| - Extension now targets .NET Framework 4.7.2, aligning with the OutSystems platform runtime. | ||
| - Replaced `Dictionary<Type, Dictionary<string, FieldHolder>>` with `ConcurrentDictionary` in `temp_ardoJSON.recCache`, eliminating the thread deadlock risk during concurrent serialization calls. | ||
| - A standalone .NET Framework 4.7.2 test project (`extension/tests/DataGridUtils.Tests.csproj`) enables testing `MssConvertData2JSON` in isolation using mock OutSystems types (`ISimpleRecord`, `IRecord`, `IOSList`), without requiring the OutSystems platform. | ||
|
|
||
| Negative consequences: | ||
|
|
||
| - The test project references compiled DLLs from the extension's `Bin/` directory, so tests must be run after building the extension. | ||
|
|
||
| ## Links | ||
|
|
||
| - `extension/DataGridUtils/Source/NET/DataGridUtils.csproj` — updated target framework. | ||
| - `extension/DataGridUtils/Source/NET/temp_ardoJSON.cs` — `ConcurrentDictionary` change. | ||
| - `extension/tests/DataGridUtils.Tests.csproj` — new test project. | ||
| - `extension/tests/ConvertData2JSONTests.cs` — test implementation with mock types. | ||
|
|
||
| ## Date | ||
|
|
||
| 2026-02-24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Architecture Decision Records (ADRs) | ||
|
|
||
| This directory contains Architecture Decision Records (ADRs) for this project. | ||
| ADRs are short documents that capture important architectural decisions, along with their context and consequences. | ||
|
|
||
| ## Purpose | ||
|
|
||
| - To document significant architectural decisions. | ||
| - To provide context for why decisions were made. | ||
| - To help onboard new team members. | ||
| - To facilitate future architectural discussions and evolution. | ||
| - To provide context to AI-powered development assistants. | ||
|
|
||
| ## Format | ||
|
|
||
| Each ADR should follow the template in `ADR-0000-Title-of-ADR.md`. | ||
|
|
||
| ## Process | ||
|
|
||
| 1. **Propose:** Copy `ADR-0000-Title-of-ADR.md` to a new file named `NNNN-title-of-adr.md`, where `NNNN` is the next sequential number and the rest is a dash-separated, lowercase version of the title. | ||
| 2. **Discuss:** Fill out the ADR and discuss it with the team. | ||
| 3. **Decide:** Once a decision is reached, update the status in the ADR (e.g., "Accepted", "Rejected", "Superseded"). | ||
| 4. **Commit:** Commit the ADR to the repository. | ||
|
|
||
| ## ADR Log | ||
|
|
||
| | ADR Number | Title | Status | Date | | ||
| | :--------- | :---------------------------------------------------------------- | :------- | :---------------------------------- | | ||
| | ADR-0000 | Template for ADRs | Meta | 2026-02-04 | | ||
| | ADR-0001 | Extension .NET Upgrade and Improvements | Accepted | 2026-02-24 | |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file removed
BIN
-177 KB
extension/DataGridUtils/Source/NET/Bin/OutSystems.HubEdition.DatabaseAbstractionLayer.dll
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.