Comments (14)
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.
Great!
from opencqrs.
Commit here: 473cb1b
from opencqrs.
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.
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.
These are two options I could add, not store the commands and return a result.
from opencqrs.
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.
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.
Doing some experiments in the dev branch: https://github.com/OpenCQRS/OpenCQRS/tree/Dev
from opencqrs.
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.
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.
I'm wondering if it might be better to still save the command but not the data associated to it.
from opencqrs.
@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
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)
- Application templates HOT 8
- [Question] Is there any plan to use Microsoft.Azure.Cosmos ? HOT 2
- Custom handler or service HOT 1
- Kledex adds "everything" to the ServiceCollection twice, or more. HOT 2
- [Question] About CommandSequence exception handling HOT 3
- Saga Pattern HOT 8
- InvalidOperationException: Unable to resolve service for type HOT 13
- Approximate Date for Snapshot support? HOT 1
- Support for tenant store HOT 1
- Support for custom discriminator in EF Stores HOT 1
- [Question] How can I setup the cosmos db context to use containers with shared throughtput option HOT 2
- How can I setup an ExecutionStrategy with Cosmos EF
- [Question] Is it possible to customize partition key on cosmos store? HOT 1
- Microservices example HOT 1
- Kledex 2.5.1 - Event handlers get called twice HOT 2
- About load Events HOT 5
- Decorate an event handler HOT 3
- Bulk capabilities HOT 3
- [Question] What is the process to contribute? HOT 3
- Following wiki, always getting 'Some services are not able to be constructed HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencqrs.