How to transfer a resource item (string) to an aspect class?
3 posts • Page 1 of 1
How to transfer a resource item (string) to an aspect class?
Hallo Gael,
I have to decide whether Laos will be the future solution for validating fields in our applications. So the following question seems to be critical for decision making:
How can I transfer a resource item (type string) to a class implementing an aspect? (The attached figure shows the scenario.)
Thanks a lot and best regards,
Stefan
I have to decide whether Laos will be the future solution for validating fields in our applications. So the following question seems to be critical for decision making:
How can I transfer a resource item (type string) to a class implementing an aspect? (The attached figure shows the scenario.)
Thanks a lot and best regards,
Stefan
You do not have the required permissions to view the files attached to this post.
- StefanJ
- Posts: 2
- Joined: Tue Apr 15, 2008 3:47 pm
- Full Name: Stefan Jauch
Re: How to transfer a resource item (string) to an aspect class?
I guess you will use override the RuntimeInitialize method to ResourceManager you want:
Note that you would better cache the ResourceManager so that all fields of the same assembly use the same instance!
Gael
- Code: Select all
class TheAspect : OnFieldAccessAspect
{
[NonSerialized] ResourceManager resourceManage;
public override void RunTimeInitialize(FieldInfo field)
{
this.resourceManager = new ResourceManager( field.DeclaringType.FullName,
field.DeclaringType.Assembly );
}
}
Note that you would better cache the ResourceManager so that all fields of the same assembly use the same instance!
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: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: How to transfer a resource item (string) to an aspect class?
Hallo Gael,
It works very well - thanks a lot!
Best regards,
Stefan
It works very well - thanks a lot!
Best regards,
Stefan
- StefanJ
- Posts: 2
- Joined: Tue Apr 15, 2008 3:47 pm
- Full Name: Stefan Jauch
3 posts • Page 1 of 1