One line of code to add GetList, Getsingle, add, and other database operation methods

Source: Internet
Author: User

The common service interface only needs to inherit the base class to be able to use the

The references are as follows:

Interface ithemepageservice:idynamicservice<themepage> {}

You can use any of the above methods.

Resolve<ithemeconfigservice> (). GetList (r=>r.appname=="User")  

Summary of common methods


/// <summary> ///Get list/// </summary> /// <param name= "predicate" >Query Criteria</param> /// <param name= "SortOrder" >Sorting Method</param> /// <returns></returns>Ienumerable<t> GetList (Expression<func<t,BOOL>> predicate =NULL, Expression<func<t,BOOL>> SortOrder =NULL); /// <summary> ///querying a single record/// </summary> /// <param name= "predicate" >Query Criteria</param> /// <returns></returns>T Getsingle (Expression<func<t,BOOL>>predicate); /// <summary> ///Delete System/// </summary> /// <param name= "predicate" >Query Criteria</param>Serviceresult Delete (Expression<func<t,BOOL>>predicate); /// <summary> ///Query Paging/// </summary> /// <param name= "Query" ></param> /// <param name= "predicate" ></param> /// <returns></returns>Pagedlist<t> getpagedlist (querymodel query, Expression<func<t,BOOL>> predicate =NULL); /// <summary> ///Number of statistics/// </summary> /// <param name= "predicate" ></param> /// <returns></returns> LongCount (Expression<func<t,BOOL>>predicate); /// <summary> ///Add a single entity/// </summary> /// <param name= "model" ></param> /// <returns></returns>Serviceresult ADD (T model); /// <summary> ///update a single entity/// </summary> /// <param name= "model" ></param> /// <returns></returns>Serviceresult Update (T model); /// <summary> ///Bulk Add multiple entities/// </summary> /// <param name= "model" ></param> /// <returns></returns>Serviceresult Addmany (ienumerable<t>soucre); /// <summary> ///Bulk update of multiple entities/// </summary> /// <param name= "model" ></param> /// <returns></returns>Serviceresult Updatemany (action<t> updateaction, Expression<func<t,BOOL>> predicate=NULL);

One line of code to add GetList, Getsingle, add, and other database operation methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.