summaryrefslogtreecommitdiff
path: root/Ivy/IvyBindingAttribute.cs
diff options
context:
space:
mode:
authorfcolin2007-02-01 12:04:16 +0000
committerfcolin2007-02-01 12:04:16 +0000
commit92757a8d629812303ff3665343bd098917cca611 (patch)
treecd995c9863aa6fc4c32ec5ce247e4c3119eb44a3 /Ivy/IvyBindingAttribute.cs
parent98ab5d0164040427f7c554febae125686284e2a7 (diff)
downloadivy-csharp-92757a8d629812303ff3665343bd098917cca611.zip
ivy-csharp-92757a8d629812303ff3665343bd098917cca611.tar.gz
ivy-csharp-92757a8d629812303ff3665343bd098917cca611.tar.bz2
ivy-csharp-92757a8d629812303ff3665343bd098917cca611.tar.xz
modification structure svn
Diffstat (limited to 'Ivy/IvyBindingAttribute.cs')
-rw-r--r--Ivy/IvyBindingAttribute.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Ivy/IvyBindingAttribute.cs b/Ivy/IvyBindingAttribute.cs
new file mode 100644
index 0000000..90c44ce
--- /dev/null
+++ b/Ivy/IvyBindingAttribute.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace IvyBus
+{
+ [AttributeUsage(AttributeTargets.Method,AllowMultiple = true)]
+ public sealed class IvyBindingAttribute : Attribute
+ {
+ private string expression;
+ private string[] args;
+
+ // translate part of expression to object property
+ public string GetExpression(object obj)
+ {
+ if (obj == null) return string.Format(expression);
+ object[] values = new object[args.Length];
+ for (int i = 0; i < args.Length; i++)
+ {
+ values[i] = obj.GetType().GetProperty(args[i]).GetValue(obj,null);
+ }
+ return string.Format(expression,values);
+ }
+
+ public IvyBindingAttribute(string expression, params string[] args)
+ {
+ this.expression = expression;
+ this.args = args;
+ }
+ }
+}