Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 02 21:31
    Leh2 opened #2413
  • Dec 02 21:31
    Leh2 opened #2413
  • Dec 02 13:51
    jeremydmiller commented #2412
  • Dec 02 13:51
    jeremydmiller commented #2412
  • Dec 02 07:32
    Leh2 ready_for_review #2409
  • Dec 02 07:32
    Leh2 ready_for_review #2409
  • Dec 02 06:50

    github-actions[bot] on gh-pages

    Documentation Update for 7.2.1 (compare)

  • Dec 02 06:49

    github-actions[bot] on v7.2.1

    (compare)

  • Dec 02 06:44

    Hawxy on master

    Improve assertion documentation… (compare)

  • Dec 02 06:34
    Hawxy closed #128
  • Dec 02 06:34

    Hawxy on master

    Fix single header assertion wit… (compare)

  • Dec 02 06:34
    Hawxy closed #129
  • Dec 02 06:29
    Hawxy commented #128
  • Dec 02 06:27
    Hawxy synchronize #129
  • Dec 02 06:24
    Hawxy edited #129
  • Dec 02 06:19
    Hawxy opened #129
  • Dec 02 04:33
    Hawxy assigned #128
  • Dec 01 22:26
    joshuaflanagan opened #2412
  • Dec 01 22:26
    joshuaflanagan opened #2412
  • Dec 01 18:58

    github-actions[bot] on v5.0.0

    (compare)

Tomas Tichy
@ttichy
Is there a way to query the MartenRegistry? I'd like to know what Subclass has been added with AddSubClass
Jeremy D. Miller
@jeremydmiller
Look off of IDocumentStore.Options. It’s a read-only view over the underlying StoreOptions. Should give you access to look at doc type by doc type.
2 replies
Sam
@iamjustsam

Hi! I have some questions regarding compiled queries

  • Should it be possible to correctly use compiled queries without parameters? When I do so and try to register the query type for code generation, it complains that the query is not a valid compiled query. If I add a parameter AND use it in the query, the registration seems to work fine.

  • Is it possible to use the tenancy helpers in a compiled query? e.g. .Where(x => x.AnyTenant()). Same situation as above, when registering the query type.

  • Should a where clause like this be possible: .Where(x => x.ChildCollection.Any())?

We have all scenario's above in compiled queries and have not had any issues with them but we are now experimenting with up-front code generation and any query that uses any of the features above fail registration with storeOptions.RegisterCompiledQueryType()

ERROR: System.ArgumentOutOfRangeException: Application.SomeCompiledQuery.<>c is not a valid Marten compiled query type (Parameter 'queryType')
   at Marten.StoreOptions.RegisterCompiledQueryType(Type queryType)
   at Application.MartenServiceCollectionExtensions.RegisterCompiledQueryTypes(StoreOptions options) in ***\Startup.Marten.cs:line 94
Jeremy D. Miller
@jeremydmiller
@iamjustsam I'm not aware of any issues like that -- and we would have fixed them if we had known. I think I need to ask you to open a GH issue with repro steps and we'll try to get any necessary fixes into 5.9. Which might be next week (definitely not this week)
1 reply
Sam
@iamjustsam
Allright, I'll try to make some clear examples and open a GH issue. Thanks!
Jeremy D. Miller
@jeremydmiller
And I can't say that I've ever tried exactly those permutations with the compiled query.
Sam
@iamjustsam
The "funny" thing is that the queries themselves actually work, it is only the registration of the types for pre-building them that fails.
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!