WCF SOA: CRUD Data Access Service … Why is this trouble (or our design is wrong)?

There is a data access service in our SOA WCF system. This service is responsible for performing CRUD (create, update, delete) operations on “system-wide” database tables, and is also for querying data Source. Any other service in the system that wants to access the table under the control of DAS must go to DAS to obtain or modify it. We use Entity Framework and built our own POCO status tracking system for this DAS.

There are other tables in our database that belong to a single service, and only store data for their own use, that is, state information that can be accessed when crashing and recovering or recording business information. We have a rule that no table can be Multiple service access: So the data required for multiple services will eventually appear in DAS.

The truth is, I never really understand why data access to services is a good idea, rather than direct access to tables. It seems to be slower, our DAS is not transactional, because it cannot send back the POCO graph of the database update (only one POCOS at a time), we also have a problem, DAS is actually another client of the service that needs data from it… Circular dependency.

Why bother DAS? Why is DAS so important in SOA? What am I missing here? Single point of control?

It is a SOA design flaw. Not all tables are part of DAS, and do certain services have their own “private” tables?

Any discussion about this welcome.

You are right to think this It’s the right way to do things, and you’re right. It slows things down and can be troublesome occasionally. SOA must sacrifice some efficiency in exchange for ensuring a single point of control for all data related to the service. In fact, in some SOA circles , Even the idea of ​​having a “universal DAS” service is a bit stinking.

By concentrating all CRUD operations into one service in the SOA application, you can ensure data integrity and execute correctly Business rules. For an example, think about the entity you want to store, it has some business rules related to it that are difficult to look at from a pure SQL perspective-for example, suppose a table that stores file references, and create/update to ensure that it exists The service of these files.

Using SOA and a single point of access to these tables, you can code the logic into the creation/update method and reasonably ensure that the data you receive from the service is valid-that is, it exists Referenced files. If someone can write to these tables or retrieve data from them, then there is no such guarantee-even if you call the service yourself, you don’t know other programmers, through malicious or just planned forgetfulness, forgetting to implement key business rules This leads to defensive programming, where each client code independently ensures business logic, and eventually disperses messy business logic throughout the application.

Another benefit is scalability and Maintainability. Assuming that one of your services is accessing large amounts of data. With SOA, everything is a “black box”, so your client code does not understand how the data is ultimately obtained. You can change your RDBMS, partition table or Implement caching and make the client code that calls it invisible-make sure you only need to make painful updates in one place. As the database code is scattered throughout the application, this upgrade becomes very painful.

There is a data access service in our SOA WCF system. This service is responsible for performing CRUD (create, update, delete) operations on “system-wide” database tables, and is also for querying data Source. Any other service in the system that wants to access the table under the control of DAS must go to DAS to obtain or modify it. We use Entity Framework and built our own POCO status tracking system for this DAS.

There are other tables in our database that belong to a single service, and only store data for their own use, that is, state information that can be accessed when crashing and recovering or recording business information. We have a rule that no table can be Multiple service access: Therefore, the data required by multiple services will eventually appear in DAS.

< p>The truth is that I never really understand why data access services are a good idea instead of directly accessing the tables. It seems to be slower, our DAS is not transactional, because it cannot send back the POCO graph of the database update (once There is only one POCOS), we also have a problem. DAS is actually another client of a service that needs data. From it… circular dependence.

Why bother DAS? Why is DAS so important in SOA? What am I missing here? Single point of control?

It is a SOA design flaw. Not all tables are part of DAS, and do certain services have their own “private” tables?

Any discussion about this is welcome.

You are right to think this is the right way to do things, and you are also right, it It slows things down, and occasionally is troublesome. SOA must sacrifice some efficiency in exchange for ensuring a single point of control for all data related to the service. In fact, in some SOA circles, even the idea of ​​having a “universal DAS” service is also It’s a bit smelly.

By centralizing all CRUD operations into one service in an SOA application, you can ensure data integrity and correctly enforce business rules. For an example, think about what you want Stored entities, it has some business rules related to it that are difficult to look at from a pure SQL perspective-for example, suppose a table that stores file references, and create/update a service that ensures the existence of these files.

Using SOA and a single point of access to these tables, you can code logic into the create/update method and reasonably ensure that the data you receive from the service is valid-that is, there are referenced files. If someone can write to these tables or Retrieving data from it, then there is no such guarantee-even if you call the service yourself, you don’t know other programmers, through malicious or just planned forgetfulness, forgetting to implement key business rules. This leads to defensive programming, where each customer The end code independently ensures the business logic, and eventually the messy business logic scattered throughout the application.

Another benefit is scalability and maintainability. Assume that one of your services is being accessed A large amount of data. With SOA, everything is a “black box”, so your client code does not understand how to get the data in the end. You can change your RDBMS, partition table or implement caching, and make the client code that calls it all Invisible-make sure you only need to make painful updates in one place. As the database code is scattered throughout the application, this upgrade becomes very painful.

Leave a Comment

Your email address will not be published.