Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
David Sousa
567
Views
7
Comments
Mapping from C# object to structure
Question
Hi guys,
I'm developing an extension that imports a .NET Assembly that takes as request an ID, calls a service with said ID and responds with a customer. A customer is defined by a series of attributes (name, surname, age, etc...).
Right now I had to define a structure and an action to map the customer to the structure in integration studio.
I wanted to know if it's possible to directly map the customer's attributes from the C# code into a structure.
Best regards,
David
Robert Chanphakeo
What do you mean by directly map?
You can copy from your c# class struct to an outsytems structure.
First you loop through your c# array list, then you copy the content into an outsystems structure record list and thats it.
RCMyItemRecord rec = new RCMyItemRecord(null); //Create a new record
rec.ssSTMyItem.ssName = "your value goes here"; //assign record with value
ssSTMyItem.Append(rec); //copy the record to the outsystems structure
1 reply
30 May 2016
Show thread
Hide thread
David Sousa
Robert Chanphakeo
wrote:
What do you mean by directly map?
You can copy from your c# class struct to an outsytems structure.
First you loop through your c# array list, then you copy the content into an outsystems structure record list and thats it.
RCMyItemRecord rec = new RCMyItemRecord(null); //Create a new record
rec.ssSTMyItem.ssName = "your value goes here"; //assign record with value
ssSTMyItem.Append(rec); //copy the record to the outsystems structure
What I needed was to import a .NET assembly with a method returning a structure to be used in OutSystems.
I would prefer if I didn't have to add structures, actions or customize the generated code to make the mappings.
Is it possible?
I think that in your solution you edit the source code to map the variables.
Kilian Hekhuis
Â
MVP
Hi David,
This is not possible. A Platform record is a different beast than a simple structure. You'll need to convert whatever is returned by the external service / assembly to a Record or Record List in your extension.
1 reply
30 May 2016
Show thread
Hide thread
David Sousa
Kilian Hekhuis
wrote:
Hi David,
This is not possible. A Platform record is a different beast than a simple structure. You'll need to convert whatever is returned by the external service / assembly to a Record or Record List in your extension.
Hi Kilian,
Thanks for the quick answer, that was exactly what I wanted to confirm.
I thought that there was a way of generating structures when importing .net assemblies. That would be great!
Kilian Hekhuis
Â
MVP
Well, importing a DLL is done in Visual Studio, which doesn't have any notion of the Platform. The only way would be to import DLLs directly with Integration Studio, but I don't see that happen, ever.
1 reply
30 May 2016
Show thread
Hide thread
David Sousa
But you can import DLL in integration studio, replicating the methods into actions.
If the input/output of a method is a complex type, it doesn't generate a structure and calls the parameter an Object. All the mappings from Outsystems record to said object have to be done in a custom action.
Kilian Hekhuis
Â
MVP
Ah, I see, didn't know that. Yes, it would probably be nice if the Platform could do that automatically.
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
 Loading...