Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 17 23:41
    gbrunton closed #1820
  • May 17 23:41
    gbrunton closed #1820
  • May 17 22:10
    bdukes opened #797
  • May 17 19:18
    bdukes opened #796
  • May 17 16:37

    jeremydmiller on plv8

    Extracted the patching support … preliminary work on separating … wip: new PLV8FeatureSchema (compare)

  • May 17 16:37

    jeremydmiller on plv8

    Extracted the patching support … preliminary work on separating … wip: new PLV8FeatureSchema (compare)

  • May 17 16:06
    gbrunton commented #1820
  • May 17 16:06
    gbrunton commented #1820
  • May 17 15:18
    jeremydmiller synchronize #1825
  • May 17 15:18
    jeremydmiller synchronize #1825
  • May 17 15:18

    jeremydmiller on slicing

    test fixes after adding in more… (compare)

  • May 17 15:18

    jeremydmiller on slicing

    test fixes after adding in more… (compare)

  • May 17 14:29
    jeremydmiller review_requested #1825
  • May 17 14:29
    jeremydmiller review_requested #1825
  • May 17 14:29
    jeremydmiller opened #1825
  • May 17 14:29
    jeremydmiller opened #1825
  • May 17 14:28

    jeremydmiller on slicing

    Removed obsolete code from mult… merging changes to multiple str… Refactored the APIs on ViewPRoj… and 5 more (compare)

  • May 17 14:28

    jeremydmiller on slicing

    Removed obsolete code from mult… merging changes to multiple str… Refactored the APIs on ViewPRoj… and 5 more (compare)

  • May 17 14:23

    jeremydmiller on slicing

    Allowing you to register a cust… Moved ProjectionOptions directl… Improved projection registratio… and 2 more (compare)

  • May 17 14:23

    jeremydmiller on slicing

    Allowing you to register a cust… Moved ProjectionOptions directl… Improved projection registratio… and 2 more (compare)

Jeremy D. Miller
@jeremydmiller
Yes
JT
@Hawxy
That doesn't make much sense.....netstandard is just an API baseline for multiple targets and has no prescribed end of life.
Jeremy D. Miller
@jeremydmiller
I’ve said that I may have been mistaken. Can we just agree top roll Baseline back to netstandard2.0 and .net 5.0, then the same on Marten and carry on?
JT
@Hawxy
For sure :)
JT
@Hawxy
Do you mind if I do nullability annotations for baseline? Some of the extensions perform empty/null checks of which the analyzer is completely oblivious to.
Jeremy D. Miller
@jeremydmiller
If you’re up for that, go for it
JT
@Hawxy
:thumbsup:
JT
@Hawxy
JasperFx/baseline#23 has a pending question but is otherwise ready for review. #1794 is ready to go, fixes all compiler warnings minus the obsolete.
Derek Greer
@derekgreer
I'm playing with event sourcing Marten examples. I'm primarily using https://martendb.io/documentation/events/ as an example. I'm finding that my events with Id properties aren't being populated. Is this expected?
Jeremy D. Miller
@jeremydmiller
What are you expecting to happen? There’s no functionality in Marten to do anything with specific event class properties. You would have access to the event metadata including its id in the various types of projections
Derek Greer
@derekgreer
Well, based on the example on that page I'd assume it would auto-assign the Id field since QuestStarted has an Id property which isn't used directly anywhere in the examples of adding events, retrieving, etc.
Jeremy D. Miller
@jeremydmiller
Okay, sorry for the confusion, but no, there’s no magic functionality with Id properties on event types
Derek Greer
@derekgreer
Related question: when retrieving an aggregate root via AggregateStream<>, what's the typical pattern for assigning an Id field? Get the stream Id from above mentioned metadata and set in one of the Apply() methods?
Jeremy D. Miller
@jeremydmiller
In the case of an aggregate, Marten auto-assigns the Id on the aggregated document.
And that functionality got a near rewrite in v4. The Apply() pattern is a superset of v3 though.
Thumann
@Thumann
Hi, I'm trying to change a stored enum value from something that no longer exists in the enum using the patching API, but it seems to be impossible. Like this:
var badFooSelect = "where (data ->> 'Foo') = 'BadFoo'";
session.Patch<Bar>(new WhereFragment(badFooSelect)).Set(x => x.Foo, FooTypes.GoodFo);
But I get the serialization error: Error converting value "BadFoo" to type bla bla bla..
Is it not possible to do this?
Jeremy D. Miller
@jeremydmiller
Any chance you could show the stacktrace? I can’t say that I’ve ever tried patching with enum values, but don’t know offhand why that wouldn’t work
Thumann
@Thumann
Based on my error, it's materializing the items and then failing the the persisted value is no longer present in the enum.
Jeremy D. Miller
@jeremydmiller
When is it doing that?
Thumann
@Thumann
Sorry, I'm misleading you
I was doing a count first, session.Query<Bar>(badFooSelect).Count; <- That's the culprit.
Jeremy D. Miller
@jeremydmiller
Okay, that makes perfect sense
Thumann
@Thumann
yeah
I was missing plv8 extensions locally, so I was testing if the count worked since the patch command failed, then forgot about it :D my bad
Jeremy D. Miller
@jeremydmiller
Okay, hope the patch works from here on out then:)
Thumann
@Thumann
I'll check back if it doesn't :) Thanks!
Jeremy D. Miller
@jeremydmiller
Hope it works just fine
Thumann
@Thumann
@jeremydmiller Hi Jeremy, My patch (I wrote earlier about enum patching) worked fine :)
Jeremy D. Miller
@jeremydmiller
Ship it!
Thumann
@Thumann
You know it! :D
So, since group by isn't supported.. and map/reduce indexes aren't a thing like they are in raven. Are there any other way to storing a 'aggreate overview' of a document type than to basically 'build' and maintain a new document type?
Jeremy D. Miller
@jeremydmiller
Not at the moment, no. GroupBy support is deep on the back log, but I didn’t even touch it as part of 4.0
Thumann
@Thumann
I have some sensor alarms coming in, the overview i present to the users is grouped by the sensor id, and a .. grouped list is shown to the user. so instead of seeing 1000 alarms, they'll see (for examples sake) 100 entries, with a grouped count on each.
The equivalent group by query would be something like. session.Query<Alarm>().ToList().GroupBy(c=> c.SensorId) ... etc. where each entry would then show the count of alarms received for each sensor.. so a 'sensor centric' view, instead of a spammy 'alarm view'
ok, thanks
Jeremy D. Miller
@jeremydmiller
You can always drop to pure SQL
And that’s our lame copout in these situations, except that it does work
Thumann
@Thumann
Can I make a SQL view and access that through marten? Or completely bypass marten for this functionality ?
Jeremy D. Miller
@jeremydmiller
Little easier to bypass Marten, but you can get at the connection for a session if you want. IQuerySession.Connection (and IDocumentSession implements IQuerySession too
Thumann
@Thumann
I meant 'session.Query<AlarmOverview>("mycrazyview")'
Jeremy D. Miller
@jeremydmiller
Ah, no, sorry
Thumann
@Thumann
got it :) custom for now it is!
JT
@Hawxy
Hello, any chance of a new alpha release? There's a few fixes in master we require :).
Babu Annamalai
@mysticmind
@Hawxy we will push out a release today :-)
1 reply
Babu Annamalai
@mysticmind
@/all 4.0.0-alpha.10 is available in NuGet
MinhMit
@MinhMit
hello supporter, i use version 4.0.0 alpha 9 and i receive error:
at LamarCompiler.AssemblyGenerator.Generate(String code)
at LamarCompiler.AssemblyGenerator.Compile(GeneratedAssembly generatedAssembly, IServiceVariableSource services)
at Marten.Events.Aggregation.AggregateProjection1.Compile(StoreOptions options) at Marten.Events.Aggregation.AggregateProjection1.Build(DocumentStore store)
at Marten.Events.Projections.ProjectionCollection.<>cDisplayClass10_0.<BuildInlineProjections>b1(ProjectionSource x)
at System.Linq.Enumerable.WhereSelectListIterator2.ToArray() at Marten.Events.Projections.ProjectionCollection.BuildInlineProjections(DocumentStore store) at Marten.Events.EventGraph.<.ctor>b__8_2() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Lazy1.CreateValue() at Marten.Events.EventGraph.<ProcessEventsAsync>d__70.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Marten.Internal.Sessions.DocumentSessionBase.<SaveChangesAsync>d__61.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Iot.Core.Infrastructure.Repositories.Implements.EventStoreRepository1.<StartStreamAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Compilation failures!
CS1003: Syntax error, ',' expected
CS1003: Syntax error, ']' expected
CS1003: Syntax error, ',' expected
CS1003: Syntax error, ',' expected
CS1026: ) expected
CS1002: ; expected
CS1513: } expected
CS1003: Syntax error, ',' expected
CS1002: ; expected
CS1002: ; expected
CS1002: ; expected
CS1003: Syntax error, ',' expected
CS1002: ; expected
CS1010: Newline in constant
CS1002: ; expected
CS1003: Syntax error, ',' expected
CS1003: Syntax error, ']' expected
CS1003: Syntax error, ',' expected
CS1003: Syntax error, ',' expected
CS1026: ) expected
CS1002: ; expected
CS1513: } expected
CS1003: Syntax error, ',' expected
CS1002: ; expected
CS1002: ; expected
CS1002: ; expected
CS1003: Syntax error, ',' expected
CS1002: ; expected
CS1010: Newline in constant
CS1002: ; expected
CS0246: The type or namespace name 'ArgumentException' could not be found (are you missing a using directive or an assembly reference?)
CS0021: Cannot apply indexing with [] to an expression of type 'int'
CS0841: Cannot use local variable 'Iot' before it is declared
CS0841: Cannot use local variable 'Iot' before it is declared
CS0103: The name 'Version' does not exist in the current context
CS0103: The name 'Culture' does not exist in the current context
CS0103: The name 'neutral' does not exist in the current context
CS0103: The name 'PublicKeyToken' does not exist in the current context
CS0246: The type or namespace name 'or' could not be found (are you missing a using directive or an assembly reference?)
CS0246: The type or namespace name 'Replayer' could not be found (are you missing a using directive or an assembly reference?)
CS0246: The type or namespace name 'have' could not be found (are you missing a using directive or an assembly reference?)
CS0246: The type or namespace name 'Default' could not be found (are you missing a using directive or an assembly reference?)
CS0246: The type or namespace name 'ArgumentException' could not be found (are you missing a using directive or an assembly reference?)
CS0021: Cannot apply indexing with [] to an expression of type 'int'
CS0103: The name 'Version' does not exist in the current context
CS0103: The name 'Culture' does not exist in the current context
CS0103: The name 'neutral' does not exist in the current context
CS0103: The name 'PublicKeyToken' does not exist in the current context
CS0246: The type or namespace name 'or' could not be found (are you missing a using directive or an assembly reference?)
CS0128: A local variable or function named 'Iot' is already defined in this scope
CS0246: The type or namespace name 'Replayer' could not be found (are you missing a using directive or an assembly reference?)
CS0128: A local variable or function named 'should' is already defined in this scope
CS0246: The type or namespace name 'have' could not be found (are you missing a using directive or an assembly reference?)
CS0128: A local variable or function named 'a' is already defined in this scope
CS0246: The type or namespace name 'Default' could not be found (are you missing a using directive or an assembly reference?)
CS0128: A local variable or function named 'Constructor' is already defined in this scope

Code:

using Marten;
using Marten.Events.Aggregation;
using Marten.Internal.Storage;
using Marten.Storage;
using System.Linq;

namespace Marten.Generated
{
// START: AggregateProjection_Iot_Replayer_Domain_Aggregates_VideoAggregateRoot_LiveAggregation
public class AggregateProjection_Iot_Replayer_Domain_Aggregates_VideoAggregateRoot_LiveAggregation : Marten.Events.Aggregation.SyncLiveAggregatorBase<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot>
{
private readonly Marten.Events.Aggregation.AggregateProjection<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot> _aggregateProjection;

    public AggregateProjection_Iot_Replayer_Domain_Aggregates_VideoAggregateRoot_LiveAggregation(Marten.Events.Aggregation.AggregateProjection<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot> aggregateProjection)
    {
        _aggregateProjection = aggregateProjection;
    }


    public System.Action<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot, Iot.Replayer.Domain.Events.VideoViewedEvent> Lambda1 {get; set;}

    public System.Action<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot, Iot.Replayer.Domain.Events.VideoInitializedEvent> Lambda2 {get; set;}


    public override Iot.Replayer.Domain.Aggregates.VideoAggregateRoot Build(System.Collections.Generic.IReadOnlyList<Marten.Events.IEvent> events, Marten.IQuerySession session, Iot.Replayer.Domain.Aggregates.VideoAggregateRoot snapshot)
    {
        if (!events.Any()) return null;
        Iot.Replayer.Domain.Aggregates.VideoAggregateRoot videoAggregateRoot = null;
        snapshot ??= Create(events[0], session);
        foreach (var @event in events)
        {
            snapshot = Apply(@event, snapshot, session);
        }

        return snapshot;
    }


    public Iot.Replayer.Domain.Aggregates.VideoAggregateRoot Create(Marten.Events.IEvent @event, Marten.IQuerySession session)
    {
        throw new System.InvalidOperationException("There is no default constructor for Iot.Replayer.Domain.Aggregates.VideoAggregateRoot");
    }


    public Iot.Replayer.Domain.Aggregates.VideoAggregateRoot Apply(Marten.Events.IEvent @event, Iot.Replayer.Domain.Aggregates.VideoAggregateRoot aggregate, Marten.IQuerySession session)
    {
        switch (@event)
        {
            case Marten.Events.IEvent<Iot.Replayer.Domain.Events.VideoViewedEvent> event_VideoViewedEvent1:
                Lambda1.Invoke(aggregate, event_VideoViewedEvent1.Data);
                break;
            case Marten.Events.IEvent<Iot.Replayer.Domain.Events.VideoInitializedEvent> event_VideoInitializedEvent2:
                Lambda2.Invoke(aggregate, event_VideoInitializedEvent2.Data);
                break;
        }

        return aggregate;
    }

}

// END: AggregateProjection_Iot_Replayer_Domain_Aggregates_VideoAggregateRoot_LiveAggregation


// START: AggregateProjection_Iot_Replayer_Domain_Aggregates_VideoAggregateRoot_InlineHandler
public class AggregateProjection_Iot_Replayer_Domain_Aggregates_VideoAggregateRoot_InlineHandler : Marten.Events.Aggregation.AggregationRuntime<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot, string>
{
    private readonly Marten.IDocumentStore _store;
    private readonly Marten.Events.Aggregation.IAggregateProjection _projection;
    private readonly Marten.Events.Aggregation.IEventSlicer<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot, string> _slicer;
    private readonly Marten.Storage.ITenancy _tenancy;
    private readonly Marten.Internal.Storage.IDocumentStorage<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot, string> _storage;
    private readonly Marten.Events.Aggregation.AggregateProjection<Iot.Replayer.Domain.Aggregates.VideoAggregateRoot> _aggregateProjection;

    public AggregateProjection_Iot_Replayer_Domain_Aggregates_VideoAggregateRoot_InlineHandler(Marten.IDocumentStore store, Marten.Events.Aggregation.IAggregateProjection projection, Marten.Eve
my AggregateRoot: