Solution postsharping...
2 posts • Page 1 of 1
Solution postsharping...
Is it possible to postsharp all assemblies in solution at once, after compilation.
I will explain wat I want.
I am using Singleton attribute from DesignByContract.
When I use singleton class from assembly where it is declared I can simply write
MySingleton obj = new MySingleton();
and this would be translated to call of MySingleton.Instance
From any other assembly in my solution I should write
MySingleton obj = MySingleton.Instance;
Such behaviour brings some mess to Singleton usage. Is it possible to translate all call's to new MySingleton() to MySingletom.Instance in every other assembly in my solution?
I think this steps should be done to achive such behaviour:
1. Process singletons home assembly and create Instance property.
2. Process all assemblies in my solution, find references to .ctor and change them to Instance property.
3. Process singletons home assembly and remove .ctor from singleton class.
Any ideas how to do this?
I will explain wat I want.
I am using Singleton attribute from DesignByContract.
When I use singleton class from assembly where it is declared I can simply write
MySingleton obj = new MySingleton();
and this would be translated to call of MySingleton.Instance
From any other assembly in my solution I should write
MySingleton obj = MySingleton.Instance;
Such behaviour brings some mess to Singleton usage. Is it possible to translate all call's to new MySingleton() to MySingletom.Instance in every other assembly in my solution?
I think this steps should be done to achive such behaviour:
1. Process singletons home assembly and create Instance property.
2. Process all assemblies in my solution, find references to .ctor and change them to Instance property.
3. Process singletons home assembly and remove .ctor from singleton class.
Any ideas how to do this?
- yatagarasu
- Posts: 1
- Joined: Sat Jun 14, 2008 12:31 pm
- First Name: Igor
- Last Name: Karatayev
Re: Solution postsharping...
Since assemblies are compiled one by one, it is better to post-compile them one by one. It solves many problems. By the way, what is a solution? A project is a quite well-defined notion, but a solution is not.
You should ask the DesignByContract authors to keep the constructor and change when it is referenced even in other assemblies. This is possible, even if there will be performance problems at compile-time.
Gael
You should ask the DesignByContract authors to keep the constructor and change when it is referenced even in other assemblies. This is possible, even if there will be performance problems at compile-time.
Gael
Gael Fraiteur, project leader
- gfraiteur
- Site Admin
- Posts: 816
- Joined: Tue Dec 18, 2007 3:09 pm
- First Name: Gael
- Last Name: Fraiteur
- Company: Coding Glove
2 posts • Page 1 of 1
