Rory Becker - DevExpress CodeRush Blog

March 2011 - Posts

  • New CodeRush Community Plugin – DX_GenerateProxy


    Generates a new Proxy class P based on source class S


    What this amounts to is a new class P which is given properties and methods matching the public ones that are possessed by S.
    When methods or properties of S are called their implementation defers to the instance of P held internally.


    • I’m beginning to prefer working in terms of interfaces where possible. I like to mock interfaces rather than classes where possible.
    • I don’t like to modify generated client-side web-service code. This therefore means that I don’t like to extract interfaces from said code.

    The solution to this problem is to wrap the client-side web-service code in a proxy of my own from which I can extract an interface without having to alter the client-side web-service itself..

    So given a web-service (W1), I can create a proxy (W1_Proxy) with all the same methods and properties as the original class. I can extract an interface from W1_Proxy and write my client-side code in terms of this interface. During testing I can implement this interface a second time in a test class (or more likely I can mock the interface), and pass this to the same code.

    This gives me

    • Client code that doesn’t depend on a specific implementation of a service
    • Client code Tests that don’t depend on the web-service in order to run and prove my code works.
    • A good feeling of having done things the right way.


    Currently this CodeProvider only acts on Class declarations for which you have source code. a Later revision will add a facility to generate a proxy for compiled types.


    Let’s start with the following code…


    Place the caret on the name of the class and then press your CodeRush Refactor key


    …and the following code will be generated for you…


    Download DX_GenerateProxy

  • New CodeRush Community Plugin – DX_InterfaceNav


    Provides a new Navigation entry (“To Implementor”) which navigates to implementations of an interface.

    The default Navigate shortcut is Ctrl+Alt+N

    You can use this plugin to navigate to Implementations of an Interface from …

    • Instance Reference -  From reference to a variable who’s type is either ISomeInterface or descends from same.
    • Class Declarations -  From the declaration of a class. Caret on class name.


    You can also use this it to Implementations of Interface Members from…

    • Method Reference -  From references to a property or method on a variable who’s type is either ISomeInterface or descends from same.
    • Variable Reference - From references to a Parameter who’s type is either ISomeInterface or descends from same.


    Work will continue on this plugin to provide additional navigations.

    Download DX_InterfaceNav

  • New CodeRush Community Plugin - DX_ConvertToTryParse


    This new plugin provides a new item for the Code menu which converts…




    There is a small limitation in this version. The new variable introduced (“Success”) is currently hardcoded and may clash with an existing variable. I’ll fix that in an update. I just wanted to get this out there for now.

    Download DX_ConvertToTryParse

  • New CodeRush Community Plugin – DX_RedundantAssignment

    Over the last few weeks I’ve returned to writing plugins for a bit, and I think some of them have reached the point where they might be useful for people beyond myself.
    This post, and the next few that follow it, are intended to just put these plugins out there and see what people think.

    Feel free to post comments and feedback.


    This first plugin is an example of how to build a simple Refactoring and CodeIssue and link them together.

    This CodeIssue will alert you if you are assigning a variable to itself. Further, the CodeIssue provides a link to a Refactoring that will remove the assignment from your code altogether.


    The refactoring is of course available in it’s own right via your CodeRush\Refactor Key


    Download DX_RedundantAssignment


Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at or call us at +1 (818) 844-3383


DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, Delphi, HTML5 or iOS & Android development. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2018 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners