better-dom | Live extension playground
kandi X-RAY | better-dom Summary
kandi X-RAY | better-dom Summary
This library is about ideas. After some time of using jQuery I found that it's just too big, has lack of features needed and the API design is debatable. In particular live extensions was one of the main ideas that encouraged me to build a new library from scratch. Vanilla DOM also has a lot of bad parts, that I'm trying to fix by providing a JavaScript wrapper for each DOM element you use in code. This extra layer allows to abstract from legacy interfaces and to add new methods on the top of particular elements without touching vanilla DOM prototypes. So the object model used is very different from what jQuery does. Note, that the better-dom project is only about the DOM. It does not contain any AJAX or BOM helper.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a function used for DOM nodes .
- Creates a find method for the given selector
- Creates a new element implementation
- Creates a function that sets the element and its descendants .
- Create a new document
- Return a function that traverses the element matching the selector path .
- End the stream
- Create a new method
- Create a document node wrapper .
- Buffer files from container
better-dom Key Features
better-dom Examples and Code Snippets
Community Discussions
Trending Discussions on better-dom
QUESTION
Situation:
To work with domain events, Jimmy Bogart proposed a method for storing events in aggregates.
This, from my point of view, is a very convenient approach. However, what about the case of a domain event in the domain service?
Domain Service should not have a state (stateless). In this case, in theory, the IDispatcher event dispatcher must be injected into the constructor of such a service.
Question:
To avoid introducing into the domain service of the event dispatcher, the suggested alternative approaches are correct:
- Saving in the domain service of events of the last operation. However, this will violate the principle of stateless for the domain service.
- Return the list of events from the service method based on the results of the operation (in the return method or in another way, depending on the capabilities of the programming language).
ANSWER
Answered 2019-Apr-01 at 22:51Note: that post was written about five years ago. You may want to review his more recent (and more detailed): Life Beyond Distributed Transactions: An Apostate's Implementation
Domain Service should not have a state
Right - and for this reason, it is very suspicious that you would want to assign responsibility for domain events in the domain service.
You might use a domain service to calculate events for the aggregate, but the storage would still belong to the aggregate structure itself. So that would probably look like a function (or, if you prefer, a method on the domain service) that accepts some arguments provided by the aggregate and returns events.
QUESTION
I've been working on a new document management project that uses DDD architecture. I'm new to DDD and event driven design, so it's been a learning experience.
My application is structured like this:
- MyProgram.Domain
- MyProgram.Infrastructure
- MyProgram.App
- MyProgram.WebApi
Domain has all of my domain logic, infrastructure is persistence, application is mostly commands and handlers, and the webapi is just the thing webapi.
Right now I'm working on implementing user authorization, and at the moment I've decided on using authorization handlers that will do permissions check before a command or query is executed. I think this gives me good flexibility perform complex resource-based authorization, since many of my permissions will depend on the current state of a certain entity.
So that is working out so far, I've implemented authorization in my application layer, leaving most of the user-specifics out of my domain model.
Now, the problem I'm trying to figure out is how to best include user information in my domain events, raised from my domain classes.
Example, I have a certain aggregate, let's say its document, and the document has a certain approval workflow. So when the document gets approved, I want to raise a domain event such as
...ANSWER
Answered 2019-Mar-09 at 14:43I think this gives me good flexibility perform complex resource-based authorization, since many of my permissions will depend on the current state of a certain entity.
That sounds like the authorization is an important part of the business rules and should be implemented in the domain layer. The fact that you have the need to enrich the domain events with user information is an indicator that the user should be part of the domain.
Without knowing the domain exactly I could imagine you have an invariant, something like: "A document can only be approved by the line manager of the author". You can not assert this invariant in the domain without the concept of users/roles.
QUESTION
I've implemented domain dispatching using a similar pattern here by overriding the SaveChanges
method on my DbContext
. I have entities with domain events that inherit a base abstract class that contains a list of domain events. I now want to enforce that the abstract class to have an Id property of a generic type.
Below is the base entity class before and after:
...ANSWER
Answered 2018-Jul-21 at 00:23One solution is to keep the original class and inherit from that:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install better-dom
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page