Reflection

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hello,

I am building an assembly that connects to a third party application via
http. I need create a http message that I post to the third party
application. The message is very complicated with alot of business rules
which I can define in a xml/config file. So, I will need to parse the xml
file and also use reflection to retrieve certain data from my business
objects via properties. This assembly will be used alot so performance is
critical. I could hardcode the business rules however maintanence would be
a pain. Any suggestions?

Thanks
 
George,
It sounds workable to me, although if your business objects are coded
properly you should not have to resort to Reflection (slow) to read their
properties, yes?
Peter
 
Purely looking at the solution from a reflection stand point here:
I've a web service which takes a string representation of a function
in a library (AFunction(1,2,3,{4,3,3}) sort of thing) and uses
reflection to call it and return the result. It's reasonably
performant.
Other schemes to consider, define all the fields in enums, then parse
the input at start up and call your functions based on the enum (ie
don't keep parsing the string). Something I've only really toyed with
is taking the XML schema and dynamically compiling the rules into an
assembly. For an idea of how easy the framework makes that, take a
look at the macro tutorial on codeproject which allows you to enter
some c# code, have it compiled and executed and even highlights
errors.
Assuming the xml isn't going to change lots (in production) you could
compile the assembly and save it to disc which will speed up start up.
Looking at it from a non reflective (reflective?) standpoint: I agree
with peter, this is solvable without reflection. If you can give a
short example that show's what you're trying to do, with the names
changed to protect the innocent I'm sure it would be straight forward
to hack out a solution or two.
 
Peter,

I am only using reflection because I want to dynamically build the http
message. I am using a xml/config file to hold tags and specific rules to
build http message and to map certain tags to my business objects. I could
hard code this with the config.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top