Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 06 20:45
    jeremydmiller closed #574
  • Dec 06 20:45

    jeremydmiller on master

    Better Disposal mechanics to ge… (compare)

  • Dec 06 19:47
    jeremydmiller closed #582
  • Dec 06 19:47
    jeremydmiller commented #582
  • Dec 06 19:47

    jeremydmiller on master

    Little rename and method access… Local routing improvements, new… (compare)

  • Dec 06 18:45
    jeremydmiller closed #563
  • Dec 06 18:45

    jeremydmiller on master

    New Endpoint.ReplyUri() method New Endpoint.ReplyEndpoint() me… Little tweak to ReplyUri mechan… (compare)

  • Dec 06 18:44
    jeremydmiller commented #563
  • Dec 06 18:39
    jeremydmiller commented #563
  • Dec 06 18:39
    jeremydmiller commented #563
  • Dec 06 18:39
    jeremydmiller commented #563
  • Dec 06 16:18
    jeremydmiller closed #586
  • Dec 06 16:18

    jeremydmiller on master

    Simplified the MessageHistory t… JasperOptions.Extensions proper… Decoupled the Marten and Sql Se… and 3 more (compare)

  • Dec 06 16:17
    jeremydmiller commented #586
  • Dec 06 15:17
    jeremydmiller commented #586
  • Dec 06 15:05
    jeremydmiller commented #586
  • Dec 06 14:31
    jeremydmiller commented #586
  • Dec 06 14:31
    jeremydmiller edited #586
  • Dec 06 14:30
    jeremydmiller commented #586
  • Dec 06 13:04
    jeremydmiller milestoned #586
ddivita
@ddivita
@oskardudycz , I figured as much. So with that said, what is the best approach to inject into a session. Considering the sessions are transient or scoped in the DI, we can pump in the tenant ID. I suppose I can pull the tenant ID off the logged in user or use a service to get the tenant
Oskar Dudycz
@oskardudycz
where ITenantProvider is your custom interface or other class that will return the tenant (eg. from http request)
ddivita
@ddivita
@oskardudycz , yep. That is what I was thinking!!!
Oskar Dudycz
@oskardudycz
:+1:
I personally was using that pattern in my application
ddivita
@ddivita
Awesome!! Good to know
Oskar Dudycz
@oskardudycz
:)
Matt Prigge
@mprigge
Are there any good examples of utilizing marten-based event sourcing in distributed systems? This may be a really basic question - I apologize for that. I am very new to Marten. I'm trying to determine how Service B would be able to read events generated by Service A in a read-only fashion (to build a read model which incorporates some of Service A's events). Is that kind of use case supported?
Oskar Dudycz
@oskardudycz
@mprigge I'm currently working on it in my sample repo https://github.com/oskardudycz/EventSourcing.NetCore
Matt Prigge
@mprigge
Oh, no kidding. Do you mean you're working on support for it or an example of how to implement it?
Oskar Dudycz
@oskardudycz
on example
it's ongoing, not yet finished
but basic integration with Kafka showing how to publis events from Marten through => MediatR (internal message Bus) => Kafka (External bus) => Elastic read model
it's already there
I'm also working on self-paced event sourcing training, basic exercies are already there also
Matt Prigge
@mprigge
Excellent. That's the sort of thing that really lets people jump into a new project. Great that you're doing that work! I will take a look. FWIW, I've found reading through your GoldenEye repo really useful as well.
Oskar Dudycz
@oskardudycz
Thank you :)
there is also sample there
but with non-distributed
If you have any questions feel free to ask here on on PM/email
If you have also some ideas suggestion what might be useful I'm also open :)
Matt Prigge
@mprigge
Thank you! That'e extremely kind of you to offer!
Jay Stevens
@jediwarpraptor
Good evening guys. Has anyone attempted to put a MongoDB wire-compatible gateway in front of Marten yet?
JT
@Hawxy
Hello, is there a preferred way to get a single document from a single tenant without setting the tenant in the session? I was thinking something like await _session.Query<TDocument>().Where(x => x.TenantIsOneOf(tenant) && x.Id == id).SingleOrDefaultAsync();
Jeremy D. Miller
@jeremydmiller
That’s an “I take pull requests” kind of question I think;)
And you’d want to do that outside of Linq to make it easier.
Babu Annamalai
@mysticmind
@Hawxy https://jasperfx.github.io/marten/documentation/documents/tenancy/basicoperations/ - you can examples of usage with and without passing tenant in session in the Default Tenancy section. Remember that if you did not pass tenant while creating a session, you may need to use TenantIsOneOf in all your LINQ queries.
Michael Lehto
@Leh2
What's the best way to determine if a document is deleted (when using soft deletes and using MaybeDeleted())? With version we have VersionedWith(x => x.Version), but can't find a equivalent for soft deletes.
Oskar Dudycz
@oskardudycz
@Leh2 Marten.Linq.SoftDeletes.MaybeDeleted or Marten.Linq.SoftDeletes.IsDeleted doesn't work?
Michael Lehto
@Leh2
Hi @oskardudycz, I'm querying with MaybeDeleted, but I want a property on the document reflecting the deleted state :)
Oskar Dudycz
@oskardudycz
you want to have that in the where selector? Or on the returned object? Because MaybeDeleted doesn't need any parameter to be queried, it should be fine to do x=> x.MaybeDeleted())
Tony Karalis
@tonykaralis
Morning all, having a bit of an issue with the AssertDatabaseMatches method. I output a DDL file, run the script in the database. then run the AssertDBMatches method expecting it to not throw an exception. Here is the output:
Message:   Expected: null
  But was:  <Marten.Schema.SchemaValidationException: Configuration to Schema Validation Failed! These changes detected:

-- data.mt_get_next_hi Diff
DROP FUNCTION data.mt_get_next_hi(entity character varying) cascade;

-- data.mt_get_next_hi Diff
CREATE OR REPLACE FUNCTION data.mt_get_next_hi(entity varchar) RETURNS int AS $$
DECLARE
    current_value bigint;
    next_value bigint;
BEGIN
    select hi_value into current_value from data.mt_hilo where entity_name = entity;
    IF current_value is null THEN
        insert into data.mt_hilo (entity_name, hi_value) values (entity, 0);
        next_value := 0;
    ELSE
        next_value := current_value + 1;
        update data.mt_hilo set hi_value = next_value where entity_name = entity;
    END IF;

    return next_value;
END
$$ LANGUAGE plpgsql;

   at Marten.Storage.TenantSchema.AssertDatabaseMatchesConfiguration()
   at MartenSchemaOps.SchemaValidator.AssertSchemaMatchesConfiguration()
   at DataSchema.Tests.SchemaValidation.AlignmentTests.Schema_Is_Valid() in

I have checked the DB and the following function exists:

-- FUNCTION: data.mt_get_next_hi(character varying)

-- DROP FUNCTION data.mt_get_next_hi(character varying);

CREATE OR REPLACE FUNCTION data.mt_get_next_hi(
    entity character varying)
    RETURNS integer
    LANGUAGE 'plpgsql'

    COST 100
    VOLATILE 
AS $BODY$
DECLARE
    current_value bigint;
    next_value bigint;
BEGIN
    select hi_value into current_value from data.mt_hilo where entity_name = entity;
    IF current_value is null THEN
        insert into data.mt_hilo (entity_name, hi_value) values (entity, 0);
        next_value := 0;
    ELSE
        next_value := current_value + 1;
        update data.mt_hilo set hi_value = next_value where entity_name = entity;
    END IF;

    return next_value;
END
$BODY$;

ALTER FUNCTION data.mt_get_next_hi(character varying)
    OWNER TO dbadmin;

Am I missing something? I tried running the patch but that doesn't help either. I have not installed anything to get hilo working as i don't use it. Do I need to?

Michael Lehto
@Leh2
@oskardudycz Yes exactly: "Or on the returned object?" :)
Oskar Dudycz
@oskardudycz
@Leh2 I think that there is no built in, but if you add to your document type property IsDeleted then imho it should be reflected in the result
@tonykaralis could you provide your DocumentStore config?
Tony Karalis
@tonykaralis
@oskardudycz sure
 var options = new StoreOptions
            {                    
                AutoCreateSchemaObjects = AutoCreate.None,
                DatabaseSchemaName = schema,
                //plv8 used for the patching api, only works if plv8 installed.
                PLV8Enabled = false
            };

            //configure the ddl script generated
            options.DdlRules.TableCreation = CreationStyle.CreateIfNotExists;

            //critical to deserializing interfaces etc
            options.Serializer(SetupCustomSerializer(customBinder));

            #region Helper object setup
            options.Schema.For<BoostOption>();
            options.Schema.For<Country>();
            options.Schema.For<Tool>();
            options.Schema.For<BenchMark>().ForeignKey<Project>(x => x.ProjectId);
            #endregion

            #region Terms
            options.Schema.For<BullseyeTerm>();
            options.Schema.For<PccCompetitor>().ForeignKey<BrandCategory>(x => x.BrandCategoryId)
                                        .ForeignKey<Country>(x => x.CountryId);
            options.Schema.For<CategoryTerm>().ForeignKey<BrandCategory>(x => x.BrandCategoryId);
            options.Schema.For<DistractorImage>().ForeignKey<BrandCategory>(x => x.BrandCategoryId)
                                        .ForeignKey<Country>(x => x.CountryId);
            #endregion

            #region Brand
            options.Schema.For<BrandCategory>();
            options.Schema.For<IBrand>().AddSubClassHierarchy(typeof(Brand))
                                  .ForeignKey<BrandCategory>(x => x.BrandCategoryId)
                                  .ForeignKey<Country>(x => x.CountryId);
            #endregion

            #region Items
            options.Schema.For<ItemCategory>();
            options.Schema.For<IItem>().AddSubClassHierarchy(typeof(Item))
                               .ForeignKey<Project>(x => x.ProjectId)
                               .ForeignKey<Country>(x => x.CountryId)
                               .UseOptimisticConcurrency(true);

            options.Schema.For<ItemTagCategory>();
            options.Schema.For<ItemTag>().ForeignKey<ItemTagCategory>(x => x.ItemTagCategoryId);
            #endregion

            #region Project Setup
            options.Schema.For<Quote>();
            options.Schema.For<ProjectStatus>();
            options.Schema.For<ProjectBrand>();
            options.Schema.For<Project>().ForeignKey<ProjectStatus>(x => x.ProjectStatusId)
                                           .ForeignKey<Quote>(x => x.QuoteId)
                                           .UseOptimisticConcurrency(true)
                                           .FullTextIndex();
            options.Schema.For<ProjectTaskManager>().ForeignKey<Project>(x => x.ProjectId);
            #endregion

            #region Survey Setup
            options.Schema.For<SurveyStatus>();
            options.Schema.For<Survey>().ForeignKey<SurveyStatus>(x => x.SurveyStatusId)
                                  .ForeignKey<Project>(x => x.ProjectId)
                                  .Duplicate(x => x.ProjectNumber);
            #endregion

            #region Idataquestion Setup
            options.Schema.For<RespondentIdMapping>().ForeignKey<Survey>(x => x.SurveyId)
                                               .ForeignKey<Project>(x => x.ProjectId)
                                               .ForeignKey<Country>(x => x.MarketId);

            options.Schema.For<IQuestionData>().AddSubClassHierarchy(DocumentStoreConfigExtensions.GetQuestionDataTypes())
                                                                .ForeignKey<Survey>(x => x.SurveyId)
                                                                .ForeignKey<Country>(x => x.CountryId)
                                                                .ForeignKey<RespondentIdMapping>(x => x.RespMapId)
                                                                .UseOptimisticConcurrency(true);
            #endregion

            #region BaseCos
Most classes use Guid, only a couple use int as Id's.
Michael Lehto
@Leh2
image.png
@oskardudycz tried the following but with no luck :(
Oskar Dudycz
@oskardudycz
@tonykaralis ok, I'll try to check that
@Leh2 could you create an issue? I'll try to have a look what we can do to make it work
Tony Karalis
@tonykaralis
@oskardudycz thanks, I am on until 5, then back in the evening if you need anything. First production app we launching this week backed by Marten :smiley:
Oskar Dudycz
@oskardudycz
wow, nice :) Happy to hear that
After it's settled it would be good to get some lessons learned and suggestion from you :)
Tony Karalis
@tonykaralis
I'd be happy to feedback any information. Really excited and shitting bricks the same time :p
Oskar Dudycz
@oskardudycz
:)