private static ActionContext CreateContext() { IActionContext ctx = ActiveRecordRegistration.GetContext(typeof(T).FullName); ctx.CombineMessageErrors = true; return(ctx as ActionContext); }
private object InvokeAction(EntityServiceContext ctx, string methodName) { // Create the appropriate type of actioncontext for the specific entity being managed. // And then set it's errors and messages to the calling context so the errors / messages // can be available to the caller. IActionContext actionContext = ActiveRecordRegistration.GetContext(ctx.EntityName); actionContext.CombineMessageErrors = true; actionContext.Item = ctx.Item; actionContext.Id = ctx.Id; actionContext.Errors = ctx.Errors; actionContext.Messages = ctx.Messages; object service = EntityRegistration.GetService(ctx.EntityName); object result = ReflectionUtils.InvokeMethod(service, methodName, new object[] { actionContext }); return(result); }