Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Dear

I am quite new for C#,I'm looking for help with the following questions.

I am Plan to build one adaptable test platform with C# to achieve the following features,it just like NI-Teststand, but quite support .Net Only.

This is dummy Test Tree, Each Step will use Reflection Call .Net Assembly

=====================
Init MCU SerialPort (serial port instance)
Init NI-Visa (visa port instance)
Send Command to MCU and check result
Send GPIB cmmand to DUT
....
Close MCU SerialPort
Close NI-VISA
=====================

The assembly dll may change form project to project, may be each steps the dll is different.

Now my question is how to pass the serial port instance and visa instance to following steps, so that the follow steps can use it without create new instance to improve efficiency.

What I have tried:

I've tried to serialize with XML, but I have no idea to continue...
Posted
Updated 10-Sep-17 20:32pm
Comments
Graeme_Grant 9-Sep-17 0:15am    
I am seeing two different questions here:
1. Using reflection to pass instances
2. Serialize instance using XML

I don't understand 1. what your problem is; 2. what you are trying to achieve. Do you understand what you are trying to do?

Please click on "Improve question" widget and update with clear specifics and a clearly defined single question.
TabZhang 11-Sep-17 0:23am    
Dear Graeme

Thanks for your answer!

Just question one, I want pass pass instances be between .Net Assembly.

Serialize instance using XML is the way I'am tring to do for this question.

What I want to do is build one test managerment software like Qualcomm QSPR and NI-Teststand.But it's much simpler.

It is test managerment software without any actual test steps inside.

Different Projects use test tree (XML file) do define the actual test steps.

each test step is call one mothod and pass some necessary parameters, all the methods that are invoked are independent of each other and are distributed across different DLLs.

But the I don't know how to pass instance between them, thanks!

XML is not the most efficient at passing data between two processes. Rather than specifying only one way of doing this, here is a Google Search that will give you a few different solutions: c# passing between processes - Google Search[^]
 
Share this answer
 
Comments
TabZhang 11-Sep-17 21:02pm    
Thanks! Actually, I have one main program (exe) and many assembly (dll), and exe call assembly one by one, what I want to do is pass data between assembly (dll), maybe xml is not the best way to do this, but I know there are two famous companies (NI, Qualcomm) use it now.
Graeme_Grant 11-Sep-17 23:40pm    
If the DLL is in the same process as the application, which it sounds like, then you just call it by the method name and pass the class just like you would in your application, no serialization required.
Pawel Wzietek 12-Sep-17 9:15am    
"each test step is call one mothod and pass some necessary parameters, all the methods that are invoked are independent of each other and are distributed across different DLLs."

I'm not sure at all I understand the problem, but maybe you just need a generic abstract class with different implementation for each dll? Eg. this is what I'm using in my library to address different interfaces in a uniform way: Multithreaded communication for GPIB/Visa/Serial interfaces[^]

Pawel
Quote:
it without create new instance to improve efficiency.
Do you really think you need that?
I strongly doubt you are going to observe a performance improvement.
 
Share this answer
 
Comments
TabZhang 11-Sep-17 21:04pm    
Thanks!

Yes,Flexibility and configurability are my main concerns.
Performance should be in the second place.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900