How to make your framework pseudo-ORM

Source: Internet
Author: User
How can we make our framework pseudo-Orm? I thought for a moment in the morning and suddenly came to the inspiration.
1. Get a complete entity
We usually obtain a primary object. We hope to obtain the set of other entities contained by the object by the way. For example, orderentity wants to access the orderitementity set by the way. Since datatable can only obtain its own, it is necessary to obtain the complete object set at the entire dataset level.
First, filldatasetbyid must be used to obtain all the data of the order corresponding to orderid.
Secondly, use the getentity of the returned orderdataset to get orderentity "entity of the master table". orderentity has an array of orderitementity.
In this way, you can access the orderitementity array of orderentity to obtain orderitementity.
2. Set a complete entity
This is relatively simple. It must be the entity of the Set primary table.
If it is added, you only need to use orderdataset. createentity () as orderentity to obtain
If it is modified or deleted, it must be the orderset. getentity () as orderentity after filldatasetbyid to modify and delete it, and then set back
3. Entity should allow the delete function
Entity can be marked as deleted. It must be obtained by getentity after filldatasetbyid. The free entity is not supported.

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.