I am preparing for MCTS 70-536, after reading this article. I am not 100% sure I understand the concept of typeforwarding. I find the steps given in the article even more confusing. Whats the deal if I am copying the sourcecode of type to be forwarded and recompiling it. What happens with old dll and the client ??
-
Type forwarding allows you to relocate a type between assemblies. So originally it is
TypeA
inAssemblyA
. By applying type-forwarding, you can end withTypeA
inAssemblyB
.The subtlety is the code that is already compiled doesn't see the change - they ask for the type in
AssemblyA
, and the runtime silently gives them the type fromAssemblyB
. This is very important if you have existing code.However; new code cannot be recompiled referencing
TypeA
without you referencingAssemblyB
.So:
- old clients don't need to be recompiled
- however, you do need to rebuild both
AssemblyA
andAssemblyB
in the above example - new code (or any recompiled code) must now reference
AssemblyB
(the new one)
coson : I read this on another website. There seems to be some benefits using this. However, one poster commented that VB.NET uses type forwarding and that it's a major issue if you are doing financial calculations). Since I have no way to contact this user, I'm curious to know if you would know why?Marc Gravell : How odd. I can think of no *direct* relationship between type-forwarding and financial calculations. I wonder if there is some subtle difference in what they mean... VB6, for example, performs a different type of type-forwarding re how it handles COM interfaces etc (when you add a method), but again; I see no direct relation to financials.
0 comments:
Post a Comment