P19 query parameters



Here is the equivalent of two query. But in fact some of the business code. The query may be more, but also the consistent business requirements change. For example, I would like to inquire employee by name how to do it?

If the parameters are more, then how to do it? Using the class, the class parameters are placed inside it.
Create a folder named RespurceParameters. In it prevents class parameters.

Change the name is DtoParameters






the Action add this parameter



to modify the interface

implementation class


within dto id to remove. Leaving only the CompanyName and SearchTerm

create query expressions, query expression when not query the database.



The final return. ToList () is the real time database queries

test

Request here return 415 status code, which is not supported by the media type, this error code indicates what we requested, it can not be anti-channeling written words because this api does not support this type of content, because the request ContentType this Header type is not passed body, but also did not pass the request
so Header or not the value of the ContentType is not supported api, will give a 415 status code.

The current query parameter is a class

Manually specify the binding source



Remove a query



 

End


 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/12545728.html