Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
AnswerRe: MD file Pin
OriginalGriff27-May-18 6:27
mveOriginalGriff27-May-18 6:27 
AnswerRe: MD file Pin
Richard MacCutchan27-May-18 6:44
mveRichard MacCutchan27-May-18 6:44 
PraiseRe: MD file Pin
Eddy Vluggen27-May-18 6:56
professionalEddy Vluggen27-May-18 6:56 
AnswerRe: MD file Pin
Member 1384619127-May-18 7:03
Member 1384619127-May-18 7:03 
GeneralRe: MD file Pin
Eddy Vluggen27-May-18 10:17
professionalEddy Vluggen27-May-18 10:17 
QuestionUsing ComboBox values to create variables and making calculations Pin
Member 1384637627-May-18 4:59
Member 1384637627-May-18 4:59 
AnswerRe: Using ComboBox values to create variables and making calculations Pin
Gerry Schmitz27-May-18 8:11
mveGerry Schmitz27-May-18 8:11 
QuestionLoad an .net assembly dll dynamically and consume its methods Pin
paulogomes25-May-18 6:33
paulogomes25-May-18 6:33 
Hi all,

Scenario: a non thread-safe .net assembly is accessed by a C# web service (multi-thread) and returns corrupted data when concurrent requests are issued due to sharing non safe data. The C# web service is consumed by a Java web site.

Actual solution: the C# web service implements by code a FIFO - First In First Out queue for the requests. With this approach, every web service call that redirects to the assembly go to the queue and is attended when the previous request to the assembly is finished. The assembly logic's performance is good and Users most time do not fell the delay caused by waiting in the queue. However it was a contingency solution and it is far to be the ideal solution.

Alternative options: load the assembly dynamically for each request and access the needed method at run-time

Drawbacks:

The code below compiles but there are syntax troubles:

Assembly pb_dll = Assembly.LoadFile("C:\\inetpub\\wwwroot\\rsasmPBService\\bin\\rs4pb2017asm.dll");
Type memberServicing = pb_dll.GetType("rs4pb2017asm.n_eas_member_servicing_iis");
string [] args = new string[2];
args[0] = orgId;
args[1] = contactId;
object memberServ_Instance = Activator.CreateInstance(memberServicing);
object Result = memberServicing.InvokeMember("getmemberoptions_iis", BindingFlags.Default |
BindingFlags.InvokeMethod,null, memberServ_Instance, args );

Return Result ;

The assembly returns a data structure that each element of the structure is an array. The elements have different data types. The structure has to be sent back to the caller.

QUESTIONS:

1. How to convert/cast the object "Result" into the structure format ?

2. In the above syntax, the arguments are passed to the assembly in an array of strings. However there are methods that expect to receive string and integer data as argument, for instance. So what could be a syntax to pass individual arguments, not an array?

Thank you for the help.

Paulo
AnswerRe: Load an .net assembly dll dynamically and consume its methods Pin
Gerry Schmitz25-May-18 7:52
mveGerry Schmitz25-May-18 7:52 
GeneralRe: Load an .net assembly dll dynamically and consume its methods Pin
Peter_in_278025-May-18 13:08
professionalPeter_in_278025-May-18 13:08 
GeneralRe: Load an .net assembly dll dynamically and consume its methods Pin
Gerry Schmitz25-May-18 13:56
mveGerry Schmitz25-May-18 13:56 
QuestionNewton Raphson method coding with C sharp Pin
Member 1384337224-May-18 9:53
Member 1384337224-May-18 9:53 
AnswerRe: Newton Raphson method coding with C sharp Pin
#realJSOP24-May-18 11:43
mve#realJSOP24-May-18 11:43 
GeneralRe: Newton Raphson method coding with C sharp Pin
OriginalGriff24-May-18 20:00
mveOriginalGriff24-May-18 20:00 
GeneralRe: Newton Raphson method coding with C sharp Pin
Gerry Schmitz25-May-18 7:20
mveGerry Schmitz25-May-18 7:20 
QuestionHaar Cascade Car Pin
Member 1373868124-May-18 8:11
Member 1373868124-May-18 8:11 
QuestionRe: Haar Cascade Car Pin
Gerry Schmitz24-May-18 10:41
mveGerry Schmitz24-May-18 10:41 
AnswerRe: Haar Cascade Car Pin
OriginalGriff24-May-18 20:02
mveOriginalGriff24-May-18 20:02 
GeneralRe: Haar Cascade Car Pin
Gerry Schmitz25-May-18 7:16
mveGerry Schmitz25-May-18 7:16 
QuestioniTextsharp - Adding radio button image to .pdf Pin
User 1367511422-May-18 22:47
User 1367511422-May-18 22:47 
AnswerRe: iTextsharp - Adding radio button image to .pdf Pin
Richard Deeming23-May-18 1:11
mveRichard Deeming23-May-18 1:11 
GeneralRe: iTextsharp - Adding radio button image to .pdf Pin
User 1367511425-May-18 3:07
User 1367511425-May-18 3:07 
QuestionHow the find and assignment field with DataView type ? Pin
Member 245846722-May-18 17:18
Member 245846722-May-18 17:18 
AnswerRe: How the find and assignment field with DataView type ? Pin
OriginalGriff22-May-18 19:04
mveOriginalGriff22-May-18 19:04 
AnswerRe: How the find and assignment field with DataView type ? Pin
Richard Deeming23-May-18 1:09
mveRichard Deeming23-May-18 1:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.