Git Product home page Git Product logo

Comments (14)

lucabriguglia avatar lucabriguglia commented on July 27, 2024 2

You can set it for the whole app and still be able to override it on a command basis by simply override the property SaveCommand

from opencqrs.

andreujuanc avatar andreujuanc commented on July 27, 2024 1

Great!

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024 1

Commit here: 473cb1b

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024

I put the business logic in the handler itself and in the aggregate. Everything related to event sourcing happens under the hood. Command handlers are the equivalent of buissness services in a layered architecture.

from opencqrs.

Ilchuk-Mihail avatar Ilchuk-Mihail commented on July 27, 2024

Yes, but if I need works with some confidential data (some encryption data, etc).
So, if I do it in commands it's data writes to DomainCommands table in not encrypted format.

Also, If I need to do some manipulation with data, and return result from command, not store it.

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024

These are two options I could add, not store the commands and return a result.

from opencqrs.

Ilchuk-Mihail avatar Ilchuk-Mihail commented on July 27, 2024

It would be great. It would solve the problem (Do private logic, and don't store anything) and also allows to return result. It's very needed.

I like this repo, and your work.
And I think, I can help with some tasks.
I like this very simple and good solution https://github.com/jbogard/MediatR .
MediatR - allows to return result.
And we can build something like this.
Thank you.

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024

Hi @Ilchuk-Mihail, sorry for the delay, tough time between work and uni :-)
I'm trying to find the best way to add a configuration option for saving commands at the global level and at the command level.
Not sure about returning results for the commands. Ideally commands should not return anything, but maybe it might be useful to return the event(s) generated.

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024

Doing some experiments in the dev branch: https://github.com/OpenCQRS/OpenCQRS/tree/Dev

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024

I have added global configuration options that can be set during registration (default value is true):

services
  .AddOpenCqrs(typeof(CreateProduct), typeof(GetProduct))
  .AddOptions(x => { x.SaveCommands = false; })
  .AddSqlServerProvider(Configuration)
  .AddServiceBusProvider(Configuration);

and the default setting can be overridden for every command using the new property SaveCommand of the IDomainCommand interface:

public interface IDomainCommand : ICommand
{
    Guid Id { get; set; }
    Guid AggregateRootId { get; set; }
    string UserId { get; set; }
    string Source { get; set; }
    DateTime TimeStamp { get; set; }
    int? ExpectedVersion { get; set; }
    bool? SaveCommand { get; set; }
}

from opencqrs.

andreujuanc avatar andreujuanc commented on July 27, 2024

Maybe he meant to do this in a by-command basis? and not for the whole app?

[SaveCommand(false)]
public class CreateProduct : DomainCommand
[UnpersistedCommand]
public class CreateProduct : DomainCommand
public class CreateProduct : UnpersistedDomainCommand

Or similar approaches.

TIL: https://en.wiktionary.org/wiki/unpersist

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024

I'm wondering if it might be better to still save the command but not the data associated to it.

from opencqrs.

Ilchuk-Mihail avatar Ilchuk-Mihail commented on July 27, 2024

@lucabriguglia
Thanks for help.

I'm wondering if it might be better to still save the command but not the data associated to it.

In my opinion, it is a better way. That way we can track all events and commands which happened in the app. We will not have any gaps.

from opencqrs.

lucabriguglia avatar lucabriguglia commented on July 27, 2024

@lucabriguglia
Thanks for help.

I'm wondering if it might be better to still save the command but not the data associated to it.

In my opinion, it is a better way. That way we can track all events and commands which happened in the app. We will not have any gaps.

I agree, I would change the SaveCommand property to SaveCommandData.

from opencqrs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.