Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where should helper classes like TypeHelper, StringHelper etc be? #70

Closed
prince272 opened this issue Oct 1, 2019 · 3 comments
Closed

Comments

@prince272
Copy link

Should helper classes be inside the Core project or the Infrastructure project?

@prince272
Copy link
Author

I just wanted to know how well you''ll be able to organize NopCommerce files using this CleanArchitecture Template.

@Xeinaemm
Copy link
Contributor

Xeinaemm commented Oct 7, 2019

Code without external dependencies - core, but more likely you should create a shared library to keep reusable code and then link this as a dependency.

Something like this:

<PackageReference Include="Ardalis.GuardClauses" />

From my perspective - I'm splitting Core into Contracts, Domain, Messages. Infrastructure into Persistence, Application, Application.Setup, Message broker. Web into UI, API(ie. API, ReadApi, PresentationApi).

Core

  • Contracts - basic models, DTOs, the definition of endpoints for API.
  • Messages - models as above but for Message Broker.
  • Domain - domain models that hold business logic in entities and value objects without EXTERNAL implementation. Just domain, root objects, etc.

Infrastructure

  • Application - implementation of business logic, CQRS that can handle commands and change domain by commands which base on external resources(other API).
  • Application.Setup - just setup to run a whole application like Autofac setup.
  • Persistence - mapping of views, tables from DB
  • Message Broker - CQRS implementation of handlers and system that run message broker service (write mode)

Web

  • API - POST Actions that invoke CQRS and then message broker(yep, next CQRS system)
  • ReadAPI - internal/external definition of data that your or any system can get
  • PresentationApi - internal read data for UI.

I just want to mention - most shareable code like CQRS, DDD base implementation that is the root of everything is from a shared library. You will not find this in the description above, but if you want to place this somewhere it would be core and shared folder.

@ardalis
Copy link
Owner

ardalis commented Apr 24, 2020

I'd agree with @Xeinaemm

@ardalis ardalis closed this as completed Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants