public TimestampedPropertyVersionDelta(object setValue, MethodInfo targetSite, long timeStamp, bool isActive = true) : base(new[]{setValue}, targetSite, timeStamp, isActive) { if( ! targetSite.IsPropertySetter()) throw new Exception(string.Format("method {0} is not a property setter.", targetSite)); var actualType = targetSite.GetParameters().Single().ParameterType; if (setValue == null && actualType.IsValueType && actualType != typeof(Nullable<>)) //nullable being a struct is annoying. throw new Exception(String.Format("Attempting to set null to a value type")); //actually looking at the comments from microsoft symbole servers on nullable, Microsoft seems to think the whole concept //of nullable is pretty annoying. Wierd serialization issues. if (setValue != null && ! setValue.GetType().IsAssignableTo(actualType)) throw new Exception(String.Format("supplied value to set is not the correct type. Supplied value is a {0} but the setter is setting a {1}", setValue.GetType(), actualType)); }
// TODO Property formating // TODO ParamArray method // TODO Void members // TODO indexers private string GetMethodCall(MethodInfo method) { if (method.IsPropertyGetter()) { return method.Name.Substring(4) + " → " + this.ReturnValue; } if (method.IsPropertySetter()) { return method.Name.Substring(4) + " = " + this.GetValue(this.Arguments.ElementAt(0).Value); } var methodCall = this.Method + "(" + string.Join(",", this.Arguments.Select(a => GetKind(a) + a.Name + ": " + a.Value.ToString()).ToArray()) + ")"; if (this.IsVoid) { return methodCall; } return " → " + this.ReturnValue.ToString(); }