internal override object FindById(Object id) { InMemoryUser curUser = SecurityFacade.CurrentUser(); Type type = _queryProxy.ProxyType; MethodInfo mi = type.GetMethod(_MethodName); ParameterInfo pi = mi.GetParameters().First(); object queryInterface = r.InstanceFromType(pi.ParameterType); var header = r.InstantiateProperty(queryInterface, "Header"); w.SetValue(header, "operation", "Query"); w.SetValue(header, "maxItems", "10"); w.SetValue(header, "rsStart", "0"); w.SetValue(header, "CreationDateTime", DateTime.Now.FromServerToRightKind()); w.SetValue(header, "SenderID", SwConstants.ExternalSystemName); w.SetValue(header, "uniqueResult", true, true); r.SetProperty(queryInterface, "Header", header); var rootQueryObject = r.InstantiateArrayReturningSingleElement(queryInterface, "Content"); object queryObject = r.InstantiateProperty(rootQueryObject, 0); w.SetQueryValue(queryObject, Metadata.Schema.IdAttribute.Name, id); try { var rawReponse = _queryProxy.CallMethod(MethodName(), new Type[] { queryInterface.GetType() }, new object[] { queryInterface }); var respArr = (Array)r.GetProperty(rawReponse, "Content"); if (respArr.Length == 0) { return(null); } var rootResponse = respArr.GetValue(0); return(r.GetProperty(rootResponse, 0)); } catch (Exception e) { var rootException = ExceptionUtil.DigRootException(e); throw rootException; } }