DesignByContract Aspect

Technical questions about PostSharp Laos.

DesignByContract Aspect

Postby PatrixJ on Mon Apr 14, 2008 8:43 am

Hi Gael,
i'd like to write a DesignByContract Aspect. I create a OnMethodBoundaryAspect which is call like this:
Code: Select all
[DbcAspect("(TestInt1>50)", ContractType.Initial)]

At compile time I like to create a class which the DbcAspect is calling when it check at runtime the contract. I know how should I create a class at compiletime (codeDom) but i don't know how can I add this class to the assembly where the contract ist defined.
I hope you understand my problem and can help me.
PatrixJ
 
Posts: 5
Joined: Fri Jan 25, 2008 10:56 am
First Name: Patrick
Last Name: Jahnke

Re: DesignByContract Aspect

Postby gfraiteur on Mon Apr 14, 2008 9:03 pm

Hi Patrick,

You cannot use CodeDom, unfortunately. Or if you use CodeDom, you have to generate another assembly and refer to it.

If you want to create a new class, you have to use the low-level APIes (PostSharp Core). Ruurd Boeke has written a great tutorial about how to extend PostSharp Laos with PostSharp Core.

Good luck!

Gael
Gael Fraiteur, project leader
gfraiteur
Site Admin
 
Posts: 839
Joined: Tue Dec 18, 2007 3:09 pm
First Name: Gael
Last Name: Fraiteur
Company: postsharp.org


Return to PostSharp Laos


cron