Cadmi
Cadmi

Reputation: 73

Business logic and deserialization

I am developing a software in ASP.NET Core, and I am following the service and repository patterns. I have a use case which consists on creating a production order. For that the user is providing some parameters (quantity, product, etc.), one of these parameters is a path to a file in another software system (for which i have a repository as well)

The logic to create the order is basically accessing to the file (which is a XML), deserialize it in an non-persitent object and create a register in my database (table Order). The data of this order is partially filled with the XML data.

I don't have clear about in which layer this logic should be, since here I need to deserialize the XML into an object, and then process it to create the Order. Is this process part of the Business Logic, Service Logic, or Repository logic?

A link which is explaining properly the differences between the types of logic is wellcome.

Upvotes: 0

Views: 204

Answers (1)

CristiC777
CristiC777

Reputation: 481

Bussiness Logic :)

I split my app up so all business logic lives in a class that is injected in my controller and the data repository gets injected into that. I leave the controller to only handle the HTTP bits and leave the logic in this other class so that it's easier to write tests for it. For Ex:

Project: Api + Web Models.

Versioned Controllers.

Web Only Helpers.

Project: Services.

Business Layer.

Logging.

Project: Data Layer Repositories

Database + Cache

Project: Non Web Models / Domain ORM Models

Project: Utilities

Extra methods/common helpers.

Miscellaneous features such as serializers/compressors.

Enums.

Factories.

Project: Optional Tests.

UnitTests.

read about this here: https://diatomenterprises.com/asp-net-mvc-business-logic-as-a-separate-layer/

Upvotes: 0

Related Questions