object reference and "some rights reserved"
6 posts • Page 1 of 1
object reference and "some rights reserved"
Hi Gael,
A couple of quick questions:
1. How can an attribute injected using Laos can have a reference to the object that is producing the call to the attribute?. Meaning if I create an attribute that inject code to a property definition, then the injected code needs to track what was the property name, of what object that has jsut change the value... think on implementing a "dirty flag" for properties. If I have 2 object of the same class, but I change the value of a property of one of them, but not the other, my custom attribute needs to know which object generating the call, so it can mark the property diry for that obejct but not for the other.
2. I noticed in the help file that you included "Copyright © by Gael Fraiteur and the postsharp.org[/url] Community. Some rights reserved." at the end of each help page. Is the licencing changing? what rights are you reserving?
Jorge Varas
Jorge Varas
- jorgeleo
- Posts: 3
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Jorge Varas
Re: object reference and "some rights reserved"
Hi Jorge,
1. It depends if the information is compile-time or runtime.
A property name, for instance, is known at compile-time and does not change at runtime. Implement this as a normal serialized instance field of the aspect. Initialize it in CompileTimeInitialize. Remember that you have one instance of the aspect class for each type or member to which it is applied (not for each *instance* of this type).
A dirty flag changes at runtime. If the aspected property is static, you can use a instance field of the aspect, but mark it as [NonSerialized]. If the property is not static, you should override the GetInstanceTagRequest method (called at compile-time). Then, at runtime, you can use the InstanceTag property of the events arguments. One of the improvements I could make is to have an 'InstanceTag' even for static properties, which will make client code easier.
2. Licensing of the code is MPL/GPL/LGPL. Licensing is not changing. Rights are described in these licenses. I do not anything 'custom'. As for the documentation, I could choose another documentation more adapted to documentation. I don't know yet.
Gael
1. It depends if the information is compile-time or runtime.
A property name, for instance, is known at compile-time and does not change at runtime. Implement this as a normal serialized instance field of the aspect. Initialize it in CompileTimeInitialize. Remember that you have one instance of the aspect class for each type or member to which it is applied (not for each *instance* of this type).
A dirty flag changes at runtime. If the aspected property is static, you can use a instance field of the aspect, but mark it as [NonSerialized]. If the property is not static, you should override the GetInstanceTagRequest method (called at compile-time). Then, at runtime, you can use the InstanceTag property of the events arguments. One of the improvements I could make is to have an 'InstanceTag' even for static properties, which will make client code easier.
2. Licensing of the code is MPL/GPL/LGPL. Licensing is not changing. Rights are described in these licenses. I do not anything 'custom'. As for the documentation, I could choose another documentation more adapted to documentation. I don't know yet.
Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 608
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: object reference and "some rights reserved"
Yup, that will make it easier. is it hard to implement?
Jorge Varas
- jorgeleo
- Posts: 3
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Jorge Varas
Re: object reference and "some rights reserved"
Hm you could offer me chocolate, I've just finished my stock.
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 608
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: object reference and "some rights reserved"
Done at revision 159.
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 608
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
6 posts • Page 1 of 1