Hi,
We are extensively using Ranorex to test a SQL Server Management Studio plugin, and as such have to run tests against different versions of management studio. To do this, I've created an partial class file to provide the facility to override certain parts of the repository for the few areas that differ between the various SSMS versions. I looked into having version specific repositories, but at the time it just was not feasible, and 95% of the objects would be duplicated.
However, since the changes to the generated code post-2.1 (i'm evaluating 2.3 atm), I now have to manually change the protection of the default class constructor ( eg MyRepo(), generated by Ranorex Spy) from private to internal every time I regenerate the code, so that I can call this constructor from my own one.
Therefore, I would like to request that the default constructor in the generated C# code be made internal, or an option added to specify this please
BTW, Ranorex rocks! We automatically launch 6-8 virtual machines with each of them running over 250 ranorex tests every night on various OS/SQL Server configurations.
Thanks
Chris
C# generated code - Change Request...
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
C# generated code - Change Request...
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: C# generated code - Change Request...
Hi,
Please can you explain us why you need this constructor with public or internal protection?
Regards,
Peter
Ranorex Support Team
We can change the default constructor protection from private to public. This is just a little change in the generation of the repository code. So it can be released with the next version of Ranorex.chrisgeorge wrote:Therefore, I would like to request that the default constructor in the generated C# code be made internal, or an option added to specify this please
The constructor protection was always set to private. I've tried the code generation of SPY (Ranorex Version 2.1.0 Build 6243) and the repository constructor is generated with protection mode private. Could you tell us in which version of Ranorex this behavior occurred?chrisgeorge wrote:However, since the changes to the generated code post-2.1 (i'm evaluating 2.3 atm), I now have to manually change the protection of the default class constructor ( eg MyRepo(), generated by Ranorex Spy) from private to internal every time I regenerate the code, so that I can call this constructor from my own one.
Please can you explain us why you need this constructor with public or internal protection?
Regards,
Peter
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: C# generated code - Change Request...
Great thanksSupport Team wrote:Hi,
We can change the default constructor protection from private to public. This is just a little change in the generation of the repository code. So it can be released with the next version of Ranorex.chrisgeorge wrote:Therefore, I would like to request that the default constructor in the generated C# code be made internal, or an option added to specify this please
I think you misunderstood. Yes the constructor has always been private and that has not changed.Support Team wrote:The constructor protection was always set to private. I've tried the code generation of SPY (Ranorex Version 2.1.0 Build 6243) and the repository constructor is generated with protection mode private. Could you tell us in which version of Ranorex this behavior occurred?chrisgeorge wrote:However, since the changes to the generated code post-2.1 (i'm evaluating 2.3 atm), I now have to manually change the protection of the default class constructor ( eg MyRepo(), generated by Ranorex Spy) from private to internal every time I regenerate the code, so that I can call this constructor from my own one.
Please can you explain us why you need this constructor with public or internal protection?
Regards,
Peter
Ranorex Support Team
We needed a way to override certain elements in the generated C# code and we did this by taking advantage of the fact that the class was partial, and most of the objects were static. So I created a new public constructor in my partial class. I could then inherit the repository class into a wrapper class using this public constructor. This worked (in 2.1) because the base objects were initialised statically.
However, because the objects are initialised in the default constructor now (2.3), I need to be able to inherit the default constructor, which is where I need to change the protection mode.
The reason we have to do all this is to support multiple versions of sql server management studio. Most of the controls in the repository can be reused across multiple versions, but some are slightly different. So rather than having multiple versions of the repository that would be a maintenance nightmare, I just override the specific objects as and when I have to.
Thanks
Chris
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: C# generated code - Change Request...
Hi Chris,
this might also work:
Michael
Ranorex Team
this might also work:
namespace YourTestProject { public partial class YourRepository { public YourRepository(object foo) : this() { } } }Its a bit ugly, though ..
Michael
Ranorex Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: C# generated code - Change Request...
d'oh "hits head in stupidity" ... of course!
Thanks . However, it will be nice not to have this extra constructor and reference the constructor directly. Look forward to it.
Cheers
Chris
Thanks . However, it will be nice not to have this extra constructor and reference the constructor directly. Look forward to it.
Cheers
Chris
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge