Click on image to view in full size.
have long had the idea of \u200b\u200ba program to inject code and compiled assemblies on hanging around the head. Finally, today was the day to create version 0.1 I present
zInject !
What is the idea behind it? Simple ...
Suppose I have a full-fledged project , with a class whose methods are M1, M2 and M3.
{public class M
public void M1 () {
...
} public void M2 () {
...
} public void M3 () {
...
}}
One day the boss comes and says: "From now on, we need to verify how much delay the implementation of the following methods: M1, M2 and M3.
Then you think:" Well would have to make new methods that run before and after M1, M2 and M3 and that they figure out how long each implementation.
public class
M
{public void M1 () {
Started
("M1");
...
Term ("M1");
} public void M2 () {
Started
("M2");
...
Term ("M2");
} public void M3 () {
Started
("M3");
...
Term ("M3");
}}
This brings a number of problems. Add this dirty code M1, M2 and M3 for the calls to new methods at the beginning and final. Worse, if I have to add new "behavior" at the beginning or end of the method, the code ends up being incomprehensible! Not to mention if each behavior (eg, security or audit) involves adding more than one line of code ... To fix comes
zInject .
To use, define an attribute that inherits from InjectionBaseAttribute
TiempoAttribute public class: public
InjectionBaseAttribute TiempoAttribute
{()}
{public override void
BeforeExecute (string method, object target) {
Started (method);
} public override void AfterExecute (string method, object target) {
Term (method);
}}
Then simply add the attribute to the methods you want: public class
M
{[Time]
public void M1 () {
...
} [Time]
public void M2 () {
...
} [Time]
public void M3 ()
{
...
}}
now say ... All very nice, but ... How do I run the code attribute?
To do this you must run the injector itself. This is done either by running from the command line when compiling the assembly, such as using a Post Build Action in Visual Studio. This utility will add in the IL of the assembly the necessary calls to methods and ExecuteAfter ExecuteBefore
To Do:
I leave the management of the project on CodePlex to download the compiled binaries and full source download their tests to download and see how it is used.
Any suggestion is welcome!
Greetings! Zaiden
Entries are open from 7 to 22 October at a cost of $ 15 in the table of the Scientific Conference at the Faculty.
Although the "spirit" the standard of Web Services, WS-Security, and other grass raised in the RFC would create a facility for agency interoperability across platforms, trying to bring them to the harshness of reality emerge ... and explode in our face.
time ago, in Lagash had to implement a TokenManager (among other things) to translate the calls made from WSE 3 to Java, using security certificates. After
be running smoothly for almost two years, the service began to fail at the time of the response of a request with a message saying "WSE590: Following Failed to resolve the key info" ... , and showed one of the nodes of Key Info, allegedly containing the Subject Key Identifier of the certificate required to decrypt the message.
The problem turned out to be that since the new certificate which they began using did not contain the Subject Key Identifier extension, to be identified, both Java and WSE generated a hash of the certificate. The big problem great was that hashes were calculated in a different way!
To fix this, within the input filter of the messages was to replace the portion of SOAP named on the certificate to be used by one created by hand to indicate the specific certificate (which, in fact, always the same as that used to send the original message).
For more information: Http://support.microsoft.com/kb/922779/en-us (the problem is not exactly the same, but the approach to solve is very similar).
Greetings! Zaiden
If you ever try to use WPF from a virtual machine in VMWare Fusion, you will notice that the application becomes unusable.
order to solve this is to disable hardware acceleration in WPF within the VM. This is done by creating the following DWORD in the windows registry:
HKEY_CURRENT_USER \\ SOFTWARE \\ Microsoft \\ Avalon.Graphics \\ DisableHWAcceleration Setting Up
and its value to 1.
Source: http://blog.joachim.at/?p=19