locked
Event stores question RRS feed

  • Question

  • User1034446946 posted

    I know what an event store is but I have no idea about how to go about creating one, well changing my current relationship database to one.

    I have load of questions about them like

    How to relationships work?

    How do id's work?

    Does it work with ORM's?

    But does anyone have a linkwhich doesn't explain an over view of what and event store is, but a practical guide about how to go about implementing and using one?

    Thursday, April 11, 2019 10:06 PM

Answers

  • User-474980206 posted

    Event sourcing is a design pattern for storing data. see:

      https://martinfowler.com/eaaDev/EventSourcing.html

    while you can implement in sql, a nosql database is more common now. Redux is a sample read only implementation. It is really handy with multiple update steps, or eventual consistency.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 12, 2019 2:12 PM
  • User765422875 posted

    Making 1-3 calls to the database depends on the design of your database and your object model. If these types have relationships in the database, then you can make one call and "load related entities".

    I assume you are trying to design something following CQRS+ES? A relational database can do the job well, but I'd probably opt for a NoSql database.

    Here is a good answer on StackOverflow that talks about this question.

    https://stackoverflow.com/questions/24974646/cqrs-data-store-approach-nosql-or-sql-server

    When you use NoSQL databases for your infrastructure data tier, you typically do not use an ORM like Entity Framework Core. Instead, you use the API provided by the NoSQL engine.

    Here are all the database providers for EF Core.

    https://docs.microsoft.com/en-us/ef/core/providers/

    Redux and EF Core have nothing to do with one another. Redux open-source JavaScript library for managing application state and EF Core is an ORM.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 14, 2019 6:35 PM
  • User765422875 posted

    I'm assuming you mean CQRS? I'm sure you already know this, but CQRS is as an application architecture pattern most commonly used with event sourcing. I would not be concerned with the read/search operations.

    The point of an ORM is so that the developer does not have to write all the boilerplate data access code themselves. An ORM makes data access more abstract and portable. ORM implementation classes know how to write vendor-specific SQL, so you don't have to. The DbContext applies only to EF and EF Core.

    If you are going to use Cosmos DB, you will have to choose the API / flavor you prefer.

    https://docs.microsoft.com/en-us/azure/cosmos-db/introduction

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 14, 2019 11:58 PM
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 15, 2019 12:34 PM
  • User765422875 posted

    Yes, I agree with that. If you use Triggers, it will reduce the number of round trips to the server. That goes with any database system utilizing triggers.

    NoSql is an advanced topic and I don't think there is anything on this site covering it in detail. You can try posting a question on StackOverflow.

    I hope I've helped you out. Good luck.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 15, 2019 1:37 PM

All replies

  • User-1764593085 posted

    Hi EnenDaveyBoy,

    Not familiar with it.You could refer to below links which may be helpful to you:

    https://eventstore.org/docs/getting-started/index.html?tabs=tabid-1%2Ctabid-dotnet-client%2Ctabid-dotnet-client-connect%2Ctabid-4

    https://github.com/oskardudycz/EventSourcing.NetCore

    You could also open an issue on https://github.com/EventStore/EventStore/issues

    Best Regards,

    Xing

    Friday, April 12, 2019 5:32 AM
  • User1034446946 posted

    Thanks for the info, really appriciate them, i thought there would be more information with the amount of articles reference the concept.

    I was wondering if its usual to have an event store and a relational db, or have one of the other?

    Friday, April 12, 2019 1:16 PM
  • User-474980206 posted

    Event sourcing is a design pattern for storing data. see:

      https://martinfowler.com/eaaDev/EventSourcing.html

    while you can implement in sql, a nosql database is more common now. Redux is a sample read only implementation. It is really handy with multiple update steps, or eventual consistency.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 12, 2019 2:12 PM
  • User1034446946 posted

    Thanks, good link makes sense

    now 2 things i still don't get.

    How do relationships work? do i just increase the number of calls to the database, eg if I a have staff, and cargo on a ship, and wanted to show it all on one page, would i be forced to make 3 calls, 1 for the ship, one for the cargo and one for the staff?

    Is there a reason to use a nosql db over a sql db?

    Does EF core support redux? or any nosql server

    i guess more reading, now I need to go and lookup nosql databases

    Friday, April 12, 2019 2:59 PM
  • User765422875 posted

    Making 1-3 calls to the database depends on the design of your database and your object model. If these types have relationships in the database, then you can make one call and "load related entities".

    I assume you are trying to design something following CQRS+ES? A relational database can do the job well, but I'd probably opt for a NoSql database.

    Here is a good answer on StackOverflow that talks about this question.

    https://stackoverflow.com/questions/24974646/cqrs-data-store-approach-nosql-or-sql-server

    When you use NoSQL databases for your infrastructure data tier, you typically do not use an ORM like Entity Framework Core. Instead, you use the API provided by the NoSQL engine.

    Here are all the database providers for EF Core.

    https://docs.microsoft.com/en-us/ef/core/providers/

    Redux and EF Core have nothing to do with one another. Redux open-source JavaScript library for managing application state and EF Core is an ORM.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 14, 2019 6:35 PM
  • User1034446946 posted

    Hi

    Yes I am am using CSRS, and i like the advantages of an ES, i just have a bit more research to do, as I am worried that using ES will increase the number of documents to search per request, doesn't that increase the search times over time?

    I am looking to moving over to a nosql db, at the moment looking at cosmosdb as I am looking to how on azure just looking to find out how to do all the other bits like using identity with cosmos db.

    After looking at cosmosdb, I asking myself whats the point of an ORM, the full context seems a little redundent.

    Sunday, April 14, 2019 10:43 PM
  • User765422875 posted

    I'm assuming you mean CQRS? I'm sure you already know this, but CQRS is as an application architecture pattern most commonly used with event sourcing. I would not be concerned with the read/search operations.

    The point of an ORM is so that the developer does not have to write all the boilerplate data access code themselves. An ORM makes data access more abstract and portable. ORM implementation classes know how to write vendor-specific SQL, so you don't have to. The DbContext applies only to EF and EF Core.

    If you are going to use Cosmos DB, you will have to choose the API / flavor you prefer.

    https://docs.microsoft.com/en-us/azure/cosmos-db/introduction

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, April 14, 2019 11:58 PM
  • User1034446946 posted

    Yup sorry was a typo, i ment cqrs, and  know what an ORM does, but don't see the point of EF as an ORM with nosql db's when the api is much easier. I will have a model structure to represent the storage, just not in the form of a context.

    I am going to use the Document API, i just need to figure out the best way to structure things.

    Lets say I have products, and websites which are both aggrogates, I need my products to have categories, and I just hold the id, and then run triggers or stored procedures to maintain the consitancy?

    Monday, April 15, 2019 11:27 AM
  • User475983607 posted

    Yup sorry was a typo, i ment cqrs, and  know what an ORM does, but don't see the point of EF as an ORM with nosql db's when the api is much easier. I will have a model structure to represent the storage, just not in the form of a context.

    I am going to use the Document API, i just need to figure out the best way to structure things.

    Lets say I have products, and websites which are both aggrogates, I need my products to have categories, and I just hold the id, and then run triggers or stored procedures to maintain the consitancy?

    Most of your threads are theoretical.  I recommend actually building something if you are interested in learning.

    Monday, April 15, 2019 11:36 AM
  • User1034446946 posted

    Can i not do both at the same time?

    Building something 5 times is a waste of time.

    Monday, April 15, 2019 12:20 PM
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 15, 2019 12:34 PM
  • User765422875 posted

    Yes, why not. Start small and build the solution up. Good luck...

    Monday, April 15, 2019 12:37 PM
  • User1034446946 posted

    deepalgorithm

    Document API, meaning Document DB? You don't need stored procedures. You install the Microsoft.Azure.DocumentDB NuGet package and use the API.

    https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-dotnet-samples

    Sorry yes document API, I know I have to use the API to run the stored proceedures and triggers, but surely if I do an update on an aggrogate and then need to update all the aggrogates that use that information, if I use a trigger to stored proceedure on the DB it will reduce the amount of data called from the server which will reduce the units transfered and reduce costs,it will also move the persistance work load to the db and off the web server.

    (Is there a nosql forum on this site,I know where to post related questions?)

    Monday, April 15, 2019 1:22 PM
  • User765422875 posted

    Yes, I agree with that. If you use Triggers, it will reduce the number of round trips to the server. That goes with any database system utilizing triggers.

    NoSql is an advanced topic and I don't think there is anything on this site covering it in detail. You can try posting a question on StackOverflow.

    I hope I've helped you out. Good luck.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 15, 2019 1:37 PM
  • User475983607 posted

    EnenDaveyBoy

    Sorry yes document API, I know I have to use the API to run the stored proceedures and triggers, but surely if I do an update on an aggrogate and then need to update all the aggrogates that use that information, if I use a trigger to stored proceedure on the DB it will reduce the amount of data called from the server which will reduce the units transfered and reduce costs,it will also move the persistance work load to the db and off the web server.

    (Is there a nosql forum on this site,I know where to post related questions?)

    This post like your others string together technical terms but the context does not make sense.  I think you mean aggregate and are asking how to reduce the traffic between the web server and DB server?

    How does this have anything to do with an Event Store?  

    I think getting in there building a demo will help with your understanding of the pattern.  Anyway, this it the approach I use.  It's not uncommon for me to redo a demo a few times until I get the hang of the pattern.  I'd rather make beginning level mistakes and redo a demo than my prod code base.  IMHO, this is a much quicker path to take.

     

    Monday, April 15, 2019 1:38 PM
  • User1034446946 posted

    Thanks for all the help.

    Monday, April 15, 2019 2:06 PM