Service Message, business entity, and data entity

Source: Internet
Author: User

Ranking explanation

 

Service Message-messages transmitted between various services in a distributed application. using WCF as an example, data contract is used.

Business Entity-Business Object Model, domain model, and business-related entities.

Data entity-the data entity that completely corresponds to the relational database structure.

 

Problem

 

Today, someone asked me a question on MSN, which caused me to think about. The question is roughly as follows:

Recently I have been studying some of the 3.0 technologies, such as WCF and LINQ. I tried to use these technologies to write a distributed news system. The system architecture is as follows:

※A data access layer contains a data entity (automatically generated ). The data access layer uses LINQ to SQL for data access operations, and converts data from data entities to business entities in the domain model.

※A business logic layer with the domain model as the core. The business logic layer uses LINQ to object to convert the business entity to the data contract of WCF.

In this way, the entire project has three entities:

※Data entity-entities corresponding to the database: News and comment;

※Business entities-hierarchical and dependent classes: News base classes, common news classes, and important news classes inherit news base classes, and news base classes hold comments;

※Service message-uses WCF as the entity of a message: it is still a news or comment type, and it has fewer unnecessary attributes than a data entity.

After the news system is ready, I am very depressed. I don't know what I did:

※The conversion from a data entity to a business entity is very troublesome, and the business entity is not suitable as a data contract. What is the significance of business entities?

※How many conversions plus WCF (based on HTTP) have poor performance in the entire system. Why is the architecture of WCF and LINQ inferior to that of ADO. net with a single physical server?

 

Discussion

 

This friend's questions involve many topics that have been discussed for a long time:

※What is the meaning of Orm?

※What is the significance of distributed (or service-oriented?

※What is the meaning of the domain model?

I think:

※In many cases, our thinking is reversed. It is not to say that we only need OO to be An ORM, but that we need to do persistent work after establishing a domain model, the complete ORM framework can help us with this conversion and storage work, reducing the amount of code.

※Linq to SQL is mainly used for database models (data entities). It cannot process the persistence of very complex domain models and can focus on adoef.

※In most cases, we feel that a concept is meaningless, or the opposite effect is more effective than the positive one. It is often because we use a cannon to fight mosquitoes. Domain Models, so, and OO are generated because the current concepts cannot meet the requirements of large projects. Not all projects are applicable to these concepts.

※Sometimes the problem is more objective from a relatively high perspective. For example, it is not objective to view performance issues from an operation, but from the perspective of the entire project and even the entire system (numerous servers.

 

Please discuss ............

(Because most of the content is directly copied from the MSN conversation, it is messy. If Dudu finds it inappropriate to immediately remove it)

Service Message, business entity, and data entity

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.