Access List of Parameters from Within an Action - .net-core

I would like to be able to generically access a list\dictionary of parameters from within an action. I know its possible to do this from within an ActionFilter by using:
ActionExecutingContext.ActionDescriptor.Parameters
But, I can't figure out a way to access that same list from within the action itself.
Backstory:
The end goal is for all of my actions to call the same function. The function will accept a stored proc name, and a list of parameters, then execute the stored proc using the supplied parameters. I have created each action so that the actions parameters are the same name\type as the stored proc parameters. Using this setup, I want to be able to just send the list of parameters associated with the action to a single generic call.
I have tried using:
HttpContext.Request.Query
But, that won't work, because I could have some action parameters that aren't required and have a default, these don't show up in the http query, and I still need them to be passed into my generic function.

"ModelState" is what I was looking for, it has everything I need, including the default values of the parameters that weren't in the query string.

Related

Pass parameters to report definition using activity. Pega8.6

I have created a report definition under -Data layer and I have set parameter there as a filter.
Now, I want to call this report under work layer and pass the parameter using activity.
How can I do that ?
Well best practice is to call that Report Definition through a parametrized Data Page if parameters are very few.
Any way you can still pass those parameters to any called Activity by using bellow steps.
Create one Property-Set method before calling report definition and set these parameters.
Param.pyReportName = "YourReportName"
Param.pyReportClass = "YourReportClass"
Param.pyPageName = "PageName"
Param.GradeParameter = "ValueOfGradeParameter"
Now call the report calling activity(your 6th step) with Pass current parameter page check box checked. By checking this check box you can pass all the parameters to the called Activity which you set in the main Activity.

Sending whole objects to meteor methods

Is it considered bad practice to pass whole objects to meteor methods and should I stick to just passing the ID, and then using the passed Id to fetch the document from within the meteor method instead?
The main consideration here is security: if your method is expecting to be passed an object, a Meteor-savvy user can call it from the console, passing any object of their choosing as the argument, whether it's in your DB or not, thereby bypassing any DB schema/validation you have set up. In order to avoid that, you need to be looking the object up in the DB in your server-side method code, which rather defeats the point of passing in the whole object rather than just the id in the first place. So, in summary, pass the id rather than the object.
If the user should be able to call your method with an arbitrary object, then I'd argue that you absolutely should be passing the whole object rather than just the id as otherwise you're necessitating storing a document in the database purely so that you can call a method on it, which is ugly. However, I think that would be a fairly unusual situation.

How to get the form name in class?

I have a form which is used for automatic journal postings.
On that form I have a Ok command button and in closeOk method of the form I call the method from my datasource table.
In the JournalCheckPost class's infoResult() method I want to determine if the method is called from my form. I know that it can be done with caller methods but I don't know how exactly it should be done technically.
It is bad practice to make a method depend on where it is called from.
What you can do is to pass an extra parameter to the LedgerJournalCheckPost and infoResult can then check that. This can be done by introducing a boolean flag and a parm method.
I think, there can be many situations:
You want to pass some parameters from form
You want to manipulate the form (for example refresh datasource after action is complete)
Something other
But in all the cases depending on particular form is not a very good idea.
In first case you can set parameters from code using parm methods, or, better pass parameters using the Args class
In the second you can cast Args.caller to some interface that contain all the methods you want and manipulate the form using that methods (see \Classes\SysFormRun_doRe usages for example)

How to write method having many parameters in REST webservice

I need to develop a web method that has many parameters. In REST, I understand a webservice has its own significance by attaching itself to particular entity and HttpVerb determines operation type.
This webmethod cannot be associated with an entity, it just calls a stored procedure and returns data, so I assume it only has only a GET method. But it has too many parameters to be fit into a URL. So, do I need to consider using POST method instead of GET.
It wouldn't really pass as 100% true to REST but you can have one web method that you call that looks at query string part of the url to get the additional parameters.
You would have a web method with a route of '/GetData'.
domain.com/GetData?Parameters=firstParm=1^secondParm=info^thirdParm=test
then in the web method, you would check the query string for Parameters and then split the string by the '^' symbol.
or
domain.com/GetData?firstParm=1&secondParm=info&thirdParm=test
this you would have to do a query string for each parameter.

TestNG testlistener - Possible to pass variables to retrieve in the ITestResult

I would like to be able to pass a variable a string variable to the ITestResult so that I can do something with it on a pass and failure.
I have a build number that is pulled off the screen and stored in a build variable. I then would like to be able to use this build variable after the test has passed or failed to report the results back to the database with this custom build text.
Does anyone know if this is possible?
You can use ITestContext#{s,g}etAttribute.

Resources