C # Summary of messy knowledge,

Source: Internet
Author: User

C # Summary of messy knowledge,

  • -When we make an http request, if we want to return the returned format in a json string: httpClient. DefaultRequestHeaders. Add ("Accept", "application/json; odata = verbose ");

  • HttpClient has a constructor. The constructor includes the HttpMessageHandler parameter, which can be customized for logical implementation.

  • Shortcut for VS2017:
    Ctrl + F12 from any base type or base member to various implementations. Go to all (Ctrl + T or Ctrl + ,):

    Directly go to any file/type/member/Symbol declaration. You can use a row of icons at the top of this function to filter the result list or use query syntax (for example, use "f searchTerm" for files and "t searchTerm" For types ).

  • Transaction Processing
    Transactions are managed and coordinated by the Transaction Manager. Each resource that affects the transaction result is managed by a resource manager. The transaction manager communicates with the resource manager to define the transaction results.

    ADO. NET transactions do not support cross-connection transactions. They are always associated with local transactions on a connection.

    Using System. enterpriseServices the advantage of using transactions is that you do not need to perform explicit Transaction processing. The runtime automatically creates transactions. You only need to add the [Transaction] feature to classes that have Transaction processing requirements. The [AutoComplete] feature marks the method as the automatic setting of the Transaction Status bit: if the method is successful, it sets the successful BIT. Therefore, the transaction can be committed. If an exception occurs, the transaction is terminated. One advantage of using System. EnterpriseServices to create a transaction is that multiple objects can be easily run in the same transaction, and the transaction can be automatically registered. The disadvantage is that it requires the COM + host model. The class using this technology must be derived from the base class ServiceComponent.

    System. Transactions
    CommittableTransaction is the only transaction class that supports submission. This class has a Commit method, and all other transaction classes can only perform rollback. The DependentTransaction class is used for transactions dependent on other transactions. Dependent transactions can depend on the transactions created from the committed transactions.

    System. transactions supports upgradeable transaction processing. When multiple SqlServer database connections are added to the transaction, this upgrade is performed. The transaction starts as a local transaction and then is upgraded to a distributed transaction. To upgrade a transaction, you must start the Distributed Transaction Coordinator (DTC ). If a transaction fails to be upgraded in the system, verify that the DTC service is started,

    One of the major advantages of System. Transactions is that environmental Transactions do not need to be registered manually using connections. This is automatically implemented in resources that support environmental Transactions.

    One way to create an environment Transaction is to create a CommittableTransaction object and assign it to the Transaction. Current attribute to initialize the environment Transaction. Another way to initialize environment transactions is to use the TransactionScope class. The constructor of the TransactionScope class creates an environment transaction.

    To use the same environment transaction in another thread, you need to use the dependent transaction.

Related Article

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.