Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 08 19:04
    gfoidl closed #2410
  • Dec 08 19:04
    gfoidl closed #2410
  • Dec 08 19:04
    gfoidl commented #2410
  • Dec 08 19:04
    gfoidl commented #2410
  • Dec 08 18:55
    natalie-o-perret commented #1283
  • Dec 08 18:55
    natalie-o-perret commented #1283
  • Dec 08 14:46
    dependabot[bot] labeled #757
  • Dec 08 14:46
    dependabot[bot] labeled #757
  • Dec 08 14:46

    dependabot[bot] on nuget

    Bump Newtonsoft.Json from 13.0.… (compare)

  • Dec 08 14:46
    dependabot[bot] opened #757
  • Dec 08 12:22
    lamelyan edited #2421
  • Dec 08 12:22
    lamelyan edited #2421
  • Dec 08 12:18
    lamelyan edited #2421
  • Dec 08 12:18
    lamelyan edited #2421
  • Dec 08 12:18
    lamelyan edited #2421
  • Dec 08 12:18
    lamelyan edited #2421
  • Dec 08 12:14
    lamelyan edited #2421
  • Dec 08 12:14
    lamelyan edited #2421
  • Dec 08 12:13
    lamelyan edited #2421
  • Dec 08 12:13
    lamelyan edited #2421
Jeremy D. Miller
@jeremydmiller
Doesn't strike me as all that surprising having been the guy who implemented the compiled query feature:)
Sam
@iamjustsam
:D
Jeremy D. Miller
@jeremydmiller
At some point we should probably stick @oskardudycz 's extension methods for writing events or documents in one line of code directly against IDocumentStore / IDocumentSession and just put them in the box.
4 replies
John Tesh
@johnteshnats_twitter

hey all, trying to time constrain the events using query all raw events and running into a System.InvalidCastException: 'Can't write CLR type System.Int32 with handler type TimestampTzHandler'

var @events = _documentSession.Events
.QueryAllRawEvents()
.Where(x =>
x.MatchesSql($"data->> 'Test' = '{foo}'") &&
x.Timestamp.CompareTo(DateTimeOffset.UtcNow.AddDays(-30)) > 0);

any thoughts on how to achieve this?

Jeremy D. Miller
@jeremydmiller
Yeah, the Linq support doesn’t know anything about the CompareTo() function.
do var cutoff = DateTimeOffset.UtcNow.AddDays(-30) and
Where(x => x.Timestamp > cutoff).*******) and see if that’s any happier
1 reply
ddivita
@ddivita

We have an app that is still using Marten 3. We have an event that contains a collection of references we want to project to their own view without having separate child events. We are concerned about the volume of child events in the DB.

    public class CostAllocatedToPlantGroup : IEvent
    {
        public Guid PlantGroupId { get; set; }       
        public List<PlantReference> Plants { get; set; }         
        public decimal AmountAllocated { get; set; } 
        public Guid StreamId => PlantGroupId;

    }

    public class PlantReference
    {
       public Guid PlantId {get; set; }
       public string PlantName {get;set;}            
    }

Is it possible to project each PlantReference into its own view projection, when the CostAllocatedToPlantGroup is applied? One idea was to inject a DocumentSession to store the individual references, but there may be a better way of managing this via the event pipeline.

1 reply
craigjcox
@craigjcox
Great talks today! When appending events to a stream w Marten, is there a way to return the current/max global position of the event store? Looking for something similar to LogPosition as part of the IWriteResult for the event store client or CurrentPosition as part of the AppendResult for SqlStreamStore
Jeremy D. Miller
@jeremydmiller
Haven't looked at SqlStreamStore in years, so can't really compare. You could get that information off the StreamAction that gets returned from Append() or StartStream(), but that information wouldn't exist until after you call SaveChangesAsync();
1 reply
Jackson Cribb
@JacksonCribb
StreamAction has the version of the stream itself but not the global position, If events in the StreamAction are updated after write could you get the Sequence from the last event?
1 reply
Jeremy D. Miller
@jeremydmiller
2 replies
Why do you need that at append time by the way?
Kenny
@campaignkenny_twitter

attempting use the upsert marten/postgres feature, and running into an issue where my old model and new model have the same id -> System.InvalidOperationException: Document 'Bob.Projections.ActivityModel' with same Id already added to the session.

i would ideally like to reuse the same Id if possible. code below

    var oldModel = await GetById(organizationId, cancellationToken);

    // attempt upsert
    _documentSession.Store(model, oldModel);
Babu Annamalai
@mysticmind
Did you persist the old model already? Or is it all happening in a set of code prior to save changes?
In a session (unit of work), prior to save changes, you can’t have 2 model instances with the same Id
Babu Annamalai
@mysticmind

You could just do the below:

_documentSession.Store(model);

In this case, this will update the existing one if it exist or insert a new one if it does not exist.

Marten will match by id to update or insert accordingly.
Oskar Dudycz
@oskardudycz
@mysticmind @jeremydmiller maybe we could add them to docs? We were talking about that, but now we have a fresh and up to date versions. Maybe on the quick start or in the dedicated one?
Babu Annamalai
@mysticmind
Yes @oskardudycz, it is a good idea to add these to our docs.
Oskar Dudycz
@oskardudycz
Babu, what's your thoughts on where to put them?
Do you have some preference?
Babu Annamalai
@mysticmind
thinking, will revert shortly...
Let us add it to "Marten as EventStore" page
If we have more talks as we go, we can add a dedicated page.
Oskar Dudycz
@oskardudycz
:+1: Sounds good to me. I'll try to send PR today
Babu Annamalai
@mysticmind
cool Oskar!
An alternative idea, have a dedicated page with the current list of talks and then add the links in the corresponding main pages
we have 3 currently, the old one on document db, and the 2 new recent ones.
Oskar Dudycz
@oskardudycz
Or maybe we could put the Jeremy's talks as the single one on the quick starts
and dedicated page with all?
Babu Annamalai
@mysticmind
that sounds okay.
Oskar Dudycz
@oskardudycz
I think that's nice for someone to get straight possibility to skim through the recording when they're trying to investigate Marten for the first time
Indeed a few videos in quick start could be too overwhelming
Babu Annamalai
@mysticmind
yes, that makes sense.
Oskar Dudycz
@oskardudycz
Let's try that then, we can always change that in the future :)
Babu Annamalai
@mysticmind
anyhow, the videos are all 1+ hrs :-)
Oskar Dudycz
@oskardudycz
I think that we could also record a shorter one
later on
with really quick start :)
Babu Annamalai
@mysticmind
yes!
Also I would want to add your quote "Event Sourcing is not difficult but a bit different"
Oskar Dudycz
@oskardudycz
:)
Babu Annamalai
@mysticmind
It quite a neat one to galvanize someone's mind to give it a deep thought.
Oskar Dudycz
@oskardudycz
Yeah, from my experience once people see Event Sourcing code with explanation the reaction is "well, that's not that hard as I heard". Of course, then once you're getting your hands dirty you need to shift your mindset a bit, but it's really not that hard :)
Especially with Marten :D
Babu Annamalai
@mysticmind
true!
Once someone gets their hand dirty, we can transpose our quote to "Your mileage may vary but everything is a still a bit different and not difficult" :-)