├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ ├── docs-prs.yml │ ├── docs.yml │ ├── on-manual-do-nuget-publish.yml │ ├── on-push-do-ci-build-pg15-jsonnet.yml │ └── on-push-do-ci-build-pgLatest-systemtextjson.yml ├── .gitignore ├── .markdownlint.json ├── .markdownlintrc ├── .nuke ├── build.schema.json └── parameters.json ├── Analysis.Build.props ├── CONTRIBUTING.md ├── Directory.Build.props ├── LICENSE ├── README.md ├── assets └── mdsnippet-sample.png ├── benchmarks ├── 1.2.5 │ ├── BulkLoading-report.html │ ├── DocumentActions-report.html │ ├── EventActions-report.html │ └── LinqActions-report.html ├── 1.3 │ ├── BulkLoading-report-default.md │ ├── BulkLoading-report-github.md │ ├── BulkLoading-report.csv │ ├── BulkLoading-report.html │ ├── DocumentActions-report-default.md │ ├── DocumentActions-report-github.md │ ├── DocumentActions-report.csv │ ├── DocumentActions-report.html │ ├── EventActions-report-default.md │ ├── EventActions-report-github.md │ ├── EventActions-report.csv │ ├── EventActions-report.html │ ├── LinqActions-report-default.md │ ├── LinqActions-report-github.md │ ├── LinqActions-report.csv │ └── LinqActions-report.html ├── 2.0.baseline │ └── results │ │ ├── BulkLoading-report-github.md │ │ ├── BulkLoading-report.csv │ │ ├── BulkLoading-report.html │ │ ├── DocumentActions-report-default.md │ │ ├── DocumentActions-report-github.md │ │ ├── DocumentActions-report.csv │ │ ├── DocumentActions-report.html │ │ ├── EventActions-report-default.md │ │ ├── EventActions-report-github.md │ │ ├── EventActions-report.csv │ │ ├── EventActions-report.html │ │ ├── LinqActions-report-default.md │ │ ├── LinqActions-report-github.md │ │ ├── LinqActions-report.csv │ │ └── LinqActions-report.html ├── 2.0.fastexpressioncompiler │ └── results │ │ ├── BulkLoading-report-default.md │ │ ├── BulkLoading-report-github.md │ │ ├── BulkLoading-report.csv │ │ ├── BulkLoading-report.html │ │ ├── DocumentActions-report-default.md │ │ ├── DocumentActions-report-github.md │ │ ├── DocumentActions-report.csv │ │ ├── DocumentActions-report.html │ │ ├── EventActions-report-default.md │ │ ├── EventActions-report.csv │ │ ├── EventActions-report.html │ │ ├── LinqActions-report-default.md │ │ ├── LinqActions-report.csv │ │ └── LinqActions-report.html └── 2.0.newtonsoft.upgrade │ └── results │ ├── BulkLoading-report-default.md │ ├── BulkLoading-report.csv │ ├── BulkLoading-report.html │ ├── DocumentActions-report-default.md │ ├── DocumentActions-report-github.md │ ├── DocumentActions-report.csv │ ├── DocumentActions-report.html │ ├── EventActions-report-default.md │ ├── EventActions-report-github.md │ ├── EventActions-report.csv │ ├── EventActions-report.html │ ├── LinqActions-report-default.md │ ├── LinqActions-report-github.md │ ├── LinqActions-report.csv │ └── LinqActions-report.html ├── build.cmd ├── build.ps1 ├── build.sh ├── build ├── .editorconfig ├── Configuration.cs ├── Directory.Build.props ├── Directory.Build.targets ├── build.cs └── build.csproj ├── docker-compose.yml ├── docs ├── .editorconfig ├── .vitepress │ ├── algolia-config.json │ ├── config.mts │ └── theme │ │ ├── CustomLayout.vue │ │ ├── custom.css │ │ └── index.js ├── .vscode │ └── settings.json ├── cSpell.json ├── community │ └── tools-and-libraries.md ├── configuration │ ├── cli.md │ ├── environment-checks.md │ ├── hostbuilder.md │ ├── ioc.md │ ├── json.md │ ├── multitenancy.md │ ├── optimized_artifact_workflow.md │ ├── prebuilding.md │ ├── retries.md │ └── storeoptions.md ├── devops │ └── devops.md ├── diagnostics.md ├── documents │ ├── aspnetcore.md │ ├── concurrency.md │ ├── deletes.md │ ├── execute-custom-sql.md │ ├── full-text.md │ ├── hierarchies.md │ ├── identity.md │ ├── index.md │ ├── indexing │ │ ├── computed-indexes.md │ │ ├── duplicated-fields.md │ │ ├── foreign-keys.md │ │ ├── gin-gist-indexes.md │ │ ├── ignore-indexes.md │ │ ├── index.md │ │ ├── metadata-indexes.md │ │ └── unique.md │ ├── initial-data.md │ ├── metadata.md │ ├── multi-tenancy.md │ ├── noda-time.md │ ├── partial-updates-patching.md │ ├── querying │ │ ├── advanced-sql.md │ │ ├── batched-queries.md │ │ ├── byid.md │ │ ├── compiled-queries.md │ │ ├── index.md │ │ ├── linq │ │ │ ├── async-enumerable.md │ │ │ ├── booleans.md │ │ │ ├── child-collections.md │ │ │ ├── extending.md │ │ │ ├── include.md │ │ │ ├── index.md │ │ │ ├── nulls.md │ │ │ ├── operators.md │ │ │ ├── paging.md │ │ │ ├── projections.md │ │ │ ├── sql.md │ │ │ └── strings.md │ │ ├── query-json.md │ │ └── sql.md │ ├── sessions.md │ ├── storage.md │ └── storing.md ├── events │ ├── appending.md │ ├── archiving.md │ ├── compacting.md │ ├── configuration.md │ ├── index.md │ ├── learning.md │ ├── metadata.md │ ├── multitenancy.md │ ├── optimizing.md │ ├── projections │ │ ├── aggregate-projections.md │ │ ├── async-daemon.md │ │ ├── custom-aggregates.md │ │ ├── custom.md │ │ ├── event-projections.md │ │ ├── flat.md │ │ ├── healthchecks.md │ │ ├── index.md │ │ ├── inline.md │ │ ├── ioc.md │ │ ├── live-aggregates.md │ │ ├── multi-stream-projections.md │ │ ├── projection-by-event-type.md │ │ ├── read-aggregates.md │ │ ├── rebuilding.md │ │ └── testing.md │ ├── protection.md │ ├── querying.md │ ├── quickstart.md │ ├── storage.md │ ├── subscriptions.md │ └── versioning.md ├── getting-started.md ├── images │ ├── StoreOptions.png │ ├── marten.jpeg │ ├── postgres-sequence.png │ ├── postgres-table-definition.png │ └── subscriptions.png ├── index.md ├── introduction.md ├── migration-guide.md ├── otel.md ├── postgres │ ├── casing │ │ ├── case-insensitive-data.md │ │ ├── index.md │ │ ├── queries.md │ │ ├── unique-values.md │ │ └── using-duplicate-fields.md │ ├── casting.md │ ├── dates.md │ ├── escaping.md │ ├── if-statements.md │ ├── index.md │ ├── indexing-jsonb.md │ ├── indexing.md │ ├── naming.md │ ├── slow-queries.md │ └── types.md ├── public │ ├── _redirects │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon.png │ ├── dotnet-aws.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── logo.png │ ├── manifest.json │ └── social.png ├── scenarios │ ├── aggregates-events-repositories.md │ ├── command_handler_workflow.md │ ├── copy-and-transform-stream.md │ ├── dynamic-data.md │ ├── index.md │ └── using-sequence-for-unique-id.md ├── schema │ ├── authorization.md │ ├── cleaning.md │ ├── exporting.md │ ├── extensions.md │ ├── index.md │ ├── migrations.md │ └── storage.md ├── support-policy.md ├── testing │ └── integration.md ├── troubleshoot.md ├── tutorials │ ├── advanced-considerations.md │ ├── conclusion.md │ ├── cross-aggregate-views.md │ ├── event-sourced-aggregate.md │ ├── evolve-to-event-sourcing.md │ ├── getting-started.md │ ├── index.md │ ├── modeling-documents.md │ ├── read-model-projections.md │ └── wolverine-integration.md └── vite.config.js ├── documentation ├── content │ ├── affix.css │ ├── affix.js │ ├── bootstrap.min.css │ ├── fubudocs.theme.css │ ├── images │ │ ├── banner.png │ │ ├── emblem.png │ │ ├── marten.jpeg │ │ ├── postgres-sequence.png │ │ └── postgres-table-definition.png │ ├── prism.css │ ├── prism.js │ ├── ribbons.css │ ├── sidebar.js │ ├── stylish-portfolio.css │ └── theme.css ├── diagrams │ ├── index.md │ ├── querying.md │ ├── storage.md │ └── v4eventstore.md ├── documentation │ ├── admin │ │ ├── index.md │ │ └── installing-plv8-windows.md │ ├── cli.md │ ├── documents │ │ ├── advanced │ │ │ ├── cleaning.md │ │ │ ├── customizing_linq.md │ │ │ ├── eject.md │ │ │ ├── existing_transactions.md │ │ │ ├── extensions.md │ │ │ ├── hierarchies.md │ │ │ ├── identitymap.md │ │ │ ├── index.md │ │ │ ├── javascript_transformations.md │ │ │ ├── optimistic_concurrency.md │ │ │ ├── patch_api.md │ │ │ ├── retrypolicy.md │ │ │ ├── soft_deletes.md │ │ │ └── structural_typing.md │ │ ├── basics │ │ │ ├── bulk_insert.md │ │ │ ├── deleting.md │ │ │ ├── index.md │ │ │ ├── initial_data.md │ │ │ ├── loading.md │ │ │ ├── order.txt │ │ │ └── persisting.md │ │ ├── command-timeouts.md │ │ ├── configuration │ │ │ ├── computed_index.md │ │ │ ├── document_policies.md │ │ │ ├── duplicated_fields.md │ │ │ ├── foreign_keys.md │ │ │ ├── full_text.md │ │ │ ├── gin_or_gist_index.md │ │ │ ├── index.md │ │ │ ├── metadata_index.md │ │ │ ├── noda_time.md │ │ │ └── unique.md │ │ ├── connections.md │ │ ├── diagnostics.md │ │ ├── identity │ │ │ ├── custom.md │ │ │ ├── guid.md │ │ │ ├── index.md │ │ │ └── sequential.md │ │ ├── index.md │ │ ├── json │ │ │ ├── index.md │ │ │ ├── jil.md │ │ │ └── newtonsoft.md │ │ ├── order.txt │ │ ├── querying │ │ │ ├── async.md │ │ │ ├── batched_queries.md │ │ │ ├── compiled_queries.md │ │ │ ├── include.md │ │ │ ├── index.md │ │ │ ├── linq.md │ │ │ ├── metadata_queries.md │ │ │ ├── order.txt │ │ │ ├── paging.md │ │ │ ├── projections.md │ │ │ ├── query_json.md │ │ │ └── sql.md │ │ └── tenancy │ │ │ ├── basicoperations.md │ │ │ ├── configuring.md │ │ │ ├── implementationdetails.md │ │ │ ├── index.md │ │ │ └── order.txt │ ├── events │ │ ├── appending.md │ │ ├── identity.md │ │ ├── index.md │ │ ├── order.txt │ │ ├── projections │ │ │ ├── async_daemon.md │ │ │ ├── custom.md │ │ │ ├── index.md │ │ │ └── projectionbyeventtype.md │ │ ├── schema.md │ │ ├── streams.md │ │ └── versioning │ │ │ └── index.md │ ├── index.md │ ├── integration.md │ ├── order.txt │ ├── postgres │ │ ├── backup-restore │ │ │ ├── index.md │ │ │ ├── local.md │ │ │ └── remote.md │ │ ├── casing │ │ │ ├── case-insensitive-data.md │ │ │ ├── index.md │ │ │ ├── order.txt │ │ │ ├── queries.md │ │ │ ├── unique-values.md │ │ │ └── using-duplicate-fields.md │ │ ├── casting.md │ │ ├── dates.md │ │ ├── escaping.md │ │ ├── if_statements.md │ │ ├── index.md │ │ ├── indexing.md │ │ ├── indexing_jsonb.md │ │ ├── naming.md │ │ ├── order.txt │ │ ├── slow_queries.md │ │ └── types.md │ ├── scenarios │ │ ├── aggregates_events_repositories.md │ │ ├── copyandtransformstream.md │ │ ├── dynamicdata.md │ │ ├── immutable_projections_readmodel.md │ │ ├── index.md │ │ └── usingsequenceforuniqueid.md │ ├── schema │ │ ├── authorization.md │ │ ├── exporting.md │ │ ├── index.md │ │ ├── metadata.md │ │ ├── migrations.md │ │ ├── order.txt │ │ ├── schema.md │ │ └── storage.md │ └── troubleshoot │ │ └── index.md ├── getting_started.md ├── layout.htm ├── migration_guide.md ├── order.txt ├── outline.txt └── splash.htm ├── mdsnippets.json ├── netlify.toml ├── package-lock.json ├── package.json ├── planning ├── MartenV4-WastazComments.md └── MartenV4.md ├── postgresql.license ├── src ├── .editorconfig ├── AspNetCoreWithMarten │ ├── AspNetCoreWithMarten.csproj │ ├── EventTypes.cs │ ├── IssueController.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Samples │ │ ├── ByConnectionString │ │ │ └── Startup.cs │ │ ├── ByNestedClosure │ │ │ └── Startup.cs │ │ ├── ByStoreOptions │ │ │ └── Startup.cs │ │ ├── ConfiguringSessionCreation │ │ │ └── Startup.cs │ │ ├── EagerInitialization │ │ │ └── Startup.cs │ │ ├── LightweightSessions │ │ │ └── Startup.cs │ │ └── PerScopeSessionCreation │ │ │ └── Startup.cs │ ├── User.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── AspNetODataWithMarten │ ├── AspNetODataWithMarten.csproj │ ├── Controllers │ │ └── WeatherForecastController.cs │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── CommandLineRunner │ ├── AsyncDaemonBootstrappingSamples.cs │ ├── CommandLineRunner.csproj │ ├── FindUserByAllTheThings.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── TestCommand.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── ContainerScopedProjectionTests │ ├── ContainerScopedProjectionTests.csproj │ ├── LetterCounts.cs │ ├── LetterProjection.cs │ ├── LetterProjection2.cs │ ├── configuration_specs.cs │ ├── projections_with_IoC_services.cs │ ├── when_registering_an_eventprojection_through_ioc_as_scoped.cs │ ├── when_registering_an_eventprojection_through_ioc_as_singleton.cs │ ├── when_registering_an_iprojection_through_ioc_as_scoped.cs │ └── when_registering_an_iprojection_through_ioc_as_singleton.cs ├── CoreTests │ ├── AssemblyInfo.cs │ ├── BootstrappingExamples.cs │ ├── Bugs │ │ ├── Bug_1151_assert_database_matches_configuration_exception.cs │ │ ├── Bug_1258_cannot_derive_updates_for_objects.cs │ │ ├── Bug_2099_json_serializer_should_handle_nulls.cs │ │ ├── Bug_2103_able_to_add_metadata_tables_in_migrations_to_events_table.cs │ │ ├── Bug_2135_open_session_should_use_provided_connection_string.cs │ │ ├── Bug_2210_ambient_transactions_plus_passing_in_a_connection.cs │ │ ├── Bug_2274_not_equals_canonicalization.cs │ │ ├── Bug_2564_database_creation.cs │ │ ├── Bug_2601_json_properties_without_names.cs │ │ ├── Bug_2602_include_with_conjoined_tenancy.cs │ │ ├── Bug_2603_similar_named_props.cs │ │ ├── Bug_2893_fulltext_index_creation.cs │ │ ├── Bug_2914_NGram_index_being_changed_incorrectly.cs │ │ ├── Bug_2916_ngram_index_when_multi_tenanted.cs │ │ ├── Bug_2917_index_on_DateOnly.cs │ │ ├── Bug_3019_gist_gin_index_on_arrays.cs │ │ ├── Bug_3083_concurrent_type_generation.cs │ │ ├── Bug_3145_migration_to_tenanted.cs │ │ ├── Bug_3266_allow_for_decimal_indexes.cs │ │ ├── Bug_3430_warn_when_indexes_are_too_big.cs │ │ ├── Bug_3499_duplicate_indexes_recreated_on_startup.cs │ │ ├── Bug_3603_migration_of_soft_deleted_partitions.cs │ │ ├── Bug_962_initial_data_populate_causing_null_ref_ex.cs │ │ └── Bug_983_autocreate_none_is_disabling_schema_validation.cs │ ├── CoreTests.csproj │ ├── Diagnostics │ │ ├── ability_to_fetch_postgres_server_version.cs │ │ └── read_only_view_of_store_options_on_document_store.cs │ ├── DocumentCleanerTests.cs │ ├── DocumentSchemaResolverTests.cs │ ├── Examples │ │ ├── CodeGenerationOptions.cs │ │ ├── EnvironmentChecks.cs │ │ ├── InitialDataSamples.cs │ │ └── MultipleDocumentStores.cs │ ├── Exceptions │ │ ├── ApplyEventExceptionTests.cs │ │ ├── MartenCommandExceptionTests.cs │ │ ├── known_exception_causes_dueto_pg10.cs │ │ └── known_exception_causes_dueto_pg9.cs │ ├── Internal │ │ └── Sessions │ │ │ └── EventTracingConnectionLifetimeTests.cs │ ├── Internals │ │ ├── PersistenceGraphTests.cs │ │ └── VersionTrackerTests.cs │ ├── Logging │ │ └── DefaultMartenLoggerTests.cs │ ├── Partitioning │ │ ├── partitioning_and_foreign_keys.cs │ │ ├── partitioning_configuration.cs │ │ ├── partitioning_documents_on_duplicate_fields.cs │ │ ├── partitioning_migrations.cs │ │ └── querying_against_conjoined_partitioning_with_tenant_id_and_subquery.cs │ ├── QuestTypes.cs │ ├── SessionOptionsTests.cs │ ├── Sessions │ │ ├── SessionSetupTests.cs │ │ └── TenantedSessionFactoryTests.cs │ ├── StoreOptionsTests.cs │ ├── Util │ │ └── ReflectionExtensionsTests.cs │ ├── VersionTrackerTests.cs │ ├── adding_custom_schema_objects.cs │ ├── all_exceptions_should_derive_from_MartenException.cs │ ├── applying_metrics.cs │ ├── auto_register_specs.cs │ ├── bootstrapping_with_service_collection_extensions.cs │ ├── configuring_marten_with_async_extensions.cs │ ├── describing_database_usage_from_DefaultTenancy.cs │ ├── enhance_polly_smoke_test.cs │ ├── executing_arbitrary_sql_as_part_of_transaction.cs │ ├── jasper_fx_mechanics.cs │ ├── migrate_from_guid_to_int_based_revisions.cs │ ├── npgsql_multiplexing.cs │ ├── reading_configuration_from_jasperfxoptions.cs │ ├── request_count_tracking.cs │ ├── retry_mechanism.cs │ ├── sticky_connection_mode.cs │ └── working_with_initial_data.cs ├── DaemonTests │ ├── AggregationExamples.cs │ ├── Aggregations │ │ ├── build_aggregate_multiple_projections.cs │ │ ├── build_aggregate_projection.cs │ │ ├── converting_projection_from_inline_to_async.cs │ │ ├── custom_aggregation_in_async_daemon.cs │ │ ├── multi_stream_projections.cs │ │ ├── multistream_data_teardown_on_rebuild.cs │ │ └── side_effects_in_aggregations.cs │ ├── AssemblyInfo.cs │ ├── Bugs │ │ ├── Bug_1995_empty_batch_update_failure.cs │ │ ├── Bug_2073_tenancy_problems.cs │ │ ├── Bug_2074_recovering_from_errors.cs │ │ ├── Bug_2159_using_QuerySession_within_async_aggregation.cs │ │ ├── Bug_2177_query_session_tenancy_in_daemon.cs │ │ ├── Bug_2201_out_of_order_exception_with_hard_deletes.cs │ │ ├── Bug_2245_async_daemon_getting_stuck.cs │ │ ├── Bug_2597_rebuilding_a_projection_with_no_matching_events_but_other_non_matching_events.cs │ │ ├── Bug_3059_double_application.cs │ │ ├── Bug_3080_WaitForNonStaleData_should_work_dammit.cs │ │ ├── Bug_3221_assert_on_wrong_identity_type_from_multi_stream_projection_to_slicer.cs │ │ ├── Bug_3802_projection_rebuild_skips_document_in_skip_mode.cs │ │ ├── Bug_deletewhere_should_remove_inserted_item.cs │ │ ├── Bug_projection_base_settings_must_be_used_by_deamon.cs │ │ └── Bug_sequential_rebuilds_throws_internally.cs │ ├── Coordination │ │ ├── AdvisoryLocksTest.cs │ │ ├── HotCold_leadership_election.cs │ │ └── blue_green_projection_deployments.cs │ ├── DaemonTests.csproj │ ├── EventProjections │ │ ├── EventProjectionWithCreate_follow_up_operations.cs │ │ ├── EventProjection_follow_up_operations.cs │ │ ├── event_projection_scenario_tests.cs │ │ ├── event_projections_end_to_end.cs │ │ ├── event_projections_end_to_end_ihost.cs │ │ ├── using_custom_projection_that_depends_on_identity_map_behavior.cs │ │ └── using_patches_in_async_mode.cs │ ├── FlatTableProjections │ │ ├── ValuesAdded.cs │ │ ├── ValuesDeleted.cs │ │ ├── ValuesSet.cs │ │ ├── ValuesSubtracted.cs │ │ ├── WriteTableWithGuidIdentifierProjection.cs │ │ └── end_to_end_with_flat_table_projections.cs │ ├── HealthChecks │ │ ├── AsyncDaemonHealthCheckExtensionsTests.cs │ │ └── AsyncDaemonHealthCheckExtensionsTestsHelpers.cs │ ├── Internals │ │ ├── AsyncOptionsTests.cs │ │ ├── GapDetectorTest.cs │ │ ├── HighWaterAgentTests.cs │ │ ├── HighWaterDetectorTests.cs │ │ ├── basic_functionality.cs │ │ ├── fetching_events.cs │ │ ├── pausing_and_resuming_the_daemon.cs │ │ ├── projection_progression_operations.cs │ │ └── service_registrations.cs │ ├── MultiTenancy │ │ ├── dynamic_spin_up_of_dynamic_tenants.cs │ │ └── multi_tenancy_by_database.cs │ ├── Resiliency │ │ ├── error_handling_defaults.cs │ │ ├── rebuilds_with_serialization_or_poison_pill_events.cs │ │ ├── skipping_unknown_event_types_in_continuous_builds.cs │ │ └── when_skipping_events_in_daemon.cs │ ├── Subscriptions │ │ ├── SubscriptionSamples.cs │ │ ├── subscribe_from_present.cs │ │ ├── subscription_configuration.cs │ │ └── subscriptions_end_to_end.cs │ ├── TestSetup.cs │ └── TestingSupport │ │ ├── Arrival.cs │ │ ├── DaemonContext.cs │ │ ├── Departure.cs │ │ ├── Direction.cs │ │ ├── IDayEvent.cs │ │ ├── Movement.cs │ │ ├── Stop.cs │ │ ├── TestLogger.cs │ │ ├── Travel.cs │ │ ├── Trip.cs │ │ ├── TripAborted.cs │ │ ├── TripEnded.cs │ │ ├── TripProjectionWithCustomName.cs │ │ ├── TripStarted.cs │ │ └── TripStream.cs ├── DocumentDbTests │ ├── AssemblyInfo.cs │ ├── Bugs │ │ ├── Batch_query_load_fails_with_multi_tenant_document.cs │ │ ├── BigIntegerTests.cs │ │ ├── Bug_1002_new_duplicate_field_write_patch_syntax_error.cs │ │ ├── Bug_1011_have_to_be_able_to_override_dbtype_on_duplicated_field.cs │ │ ├── Bug_1018_multi_key_unique_index_schema_update_assert_failure.cs │ │ ├── Bug_1060_invalid_cast_exception_on_doc_with_subclass.cs │ │ ├── Bug_1061_string_enum_serialization_does_not_work_with_ginindexjsondata.cs │ │ ├── Bug_113_same_named_class_different_namespaces.cs │ │ ├── Bug_1155_null_duplicate_fields.cs │ │ ├── Bug_127_do_not_recreate_a_table_with_duplicated_string_field_Tests.cs │ │ ├── Bug_130_enable_case_insensitive_custom_sql_queries_Tests.cs │ │ ├── Bug_1416_foreign_key_with_document_alias.cs │ │ ├── Bug_1429_fk_ordering_problems.cs │ │ ├── Bug_1454_comparison_between_data_offset_in_child_collection.cs │ │ ├── Bug_1563_user_friendly_warning_about_public_type.cs │ │ ├── Bug_1647_cannot_use_Task_as_document_name.cs │ │ ├── Bug_1779_null_comparison_to_foreign_key_column_not_generating_is_null.cs │ │ ├── Bug_1821_schema_validation_fails_if_document_has_indexes_or_foreign_keys.cs │ │ ├── Bug_1822_recreating_index_fails_if_there_are_more_than_one_change.cs │ │ ├── Bug_1841_float_as_duplicated_field.cs │ │ ├── Bug_1871_includes_with_snake_case_json.cs │ │ ├── Bug_1872_concurrent_creation_of_document_mappings.cs │ │ ├── Bug_187_not_assigning_id_in_BulkInsert_Tests.cs │ │ ├── Bug_1975_bulk_insert_of_nested_guid.cs │ │ ├── Bug_1982_custom_index_with_include.cs │ │ ├── Bug_1984_need_to_recursively_reference_assemblies_in_lamar_code_generation.cs │ │ ├── Bug_1994_insert_update_on_same_object_in_transaction.cs │ │ ├── Bug_2018_fts_string_list.cs │ │ ├── Bug_2049_custom_id_generation_code_gen.cs │ │ ├── Bug_2169_concurrency_error.cs │ │ ├── Bug_2211_select_transform_inner_object.cs │ │ ├── Bug_2283_problems_with_duplicated_DateTime_fields.cs │ │ ├── Bug_2327_using_identity_extension_on_class_with_invalid_type_id_field.cs │ │ ├── Bug_237_duplicate_indexing_Tests.cs │ │ ├── Bug_2523_using_query_on_custom_storage_table.cs │ │ ├── Bug_2660_deletes_in_complex_order.cs │ │ ├── Bug_274_cyclic_dependency_found_Tests.cs │ │ ├── Bug_2914_NGram_index_getting_recreated.cs │ │ ├── Bug_2942_include_error.cs │ │ ├── Bug_2955_allow_for_same_aliased_entity_in_multiple_schemas.cs │ │ ├── Bug_2983_DateTimeOffset_index_being_erroneously_recreated.cs │ │ ├── Bug_3173_fulltextindex_should_map_properties.cs │ │ ├── Bug_3194_gist_index_on_object_array.cs │ │ ├── Bug_3274_include_pagedlist_with_mapped_tenantid.cs │ │ ├── Bug_336_completely_remove_crosses_schema_lines.cs │ │ ├── Bug_3378_jsonb_ops_index_syntax.cs │ │ ├── Bug_339_async_cache_problem.cs │ │ ├── Bug_3464_Include_with_SingleOrDefault.cs │ │ ├── Bug_3708_NGram_in_other_schema.cs │ │ ├── Bug_382_bulk_insert_that_causes_multiple_batches.cs │ │ ├── Bug_393_issue_with_identity_map.cs │ │ ├── Bug_416_cannot_create_index_on_datetime_field.cs │ │ ├── Bug_431_not_patching_with_the_doc_type_column.cs │ │ ├── Bug_495_concurrent_check_by_not_first_loading_from_the_session.cs │ │ ├── Bug_550_schema_diff_with_precision.cs │ │ ├── Bug_553_ForeignKey_attribute_is_not_creating_an_index.cs │ │ ├── Bug_571_defensive_check_for_IEnumerable_of_T_in_Store.cs │ │ ├── Bug_620_alias_bool.cs │ │ ├── Bug_621_bulk_insert_with_optimistic_concurrency.cs │ │ ├── Bug_628_fk_from_doc_to_itself.cs │ │ ├── Bug_635_operations_order_in_same_session.cs │ │ ├── Bug_648_defensive_programming_checks_on_bad_id_type.cs │ │ ├── Bug_654_document_session_delete_Tests.cs │ │ ├── Bug_673_multiple_version_assertions.cs │ │ ├── Bug_772_index_wrapping_column_does_not_match_DDL.cs │ │ ├── Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema.cs │ │ ├── Bug_902_generic_type_documents.cs │ │ ├── Bug_931_duplicate_field_att_not_working_for_array_or_list.cs │ │ ├── Bug_953_too_long_index_names.cs │ │ ├── Bug_957_duplicating_a_string_array.cs │ │ ├── Bug_960_drop_index_concurrently_pg_error.cs │ │ ├── Bug_961_custom_identity_field_with_fk.cs │ │ ├── Bug_964_optimistic_concurrency_with_subclass.cs │ │ ├── Bug_980_bulk_insert_with_subclass.cs │ │ ├── Bug_986_duplicated_fields_with_int_array.cs │ │ ├── Bug_PR_1412_spaces_in_table_name_cause_schema_patch_to_fail.cs │ │ ├── Bug_PR_2277_upsert_deleted_with_unique_key.cs │ │ ├── SelfForeignKeyBugs.cs │ │ ├── SubClassForeignKeyBugs.cs │ │ ├── ability_to_persist_generic_types.cs │ │ ├── ability_to_persist_nested_types_Tests.cs │ │ ├── bug_1338_Validate_Null_ForeignKeyDefinition_ReferenceDocumenType.cs │ │ ├── identity_map_with_records.cs │ │ ├── optimistic_concurrency_with_update_method.cs │ │ └── querying_child_collections_impact_each_other.cs │ ├── Concurrency │ │ ├── numeric_revisioning.cs │ │ └── optimistic_concurrency.cs │ ├── Configuration │ │ ├── DocumentMappingTests.cs │ │ ├── MartenRegistryTests.cs │ │ ├── ability_to_add_custom_storage_features.cs │ │ ├── configuring_the_document_type_alias.cs │ │ ├── document_policies.cs │ │ ├── document_policies_for_metadata.cs │ │ └── ignoring_indexes_on_document_table.cs │ ├── Deleting │ │ ├── configuring_mapping_deletion_style.cs │ │ ├── delete_a_single_document.cs │ │ ├── delete_many_documents_by_query.cs │ │ ├── deleting_multiple_documents.cs │ │ └── soft_deletes.cs │ ├── DocumentDbTests.csproj │ ├── ForeignKeys │ │ ├── configuring_foreign_key_fields.cs │ │ └── foreign_keys.cs │ ├── HierarchicalStorage │ │ ├── BasePolicy.cs │ │ ├── Bug_1247_end_to_end_query_with_include_and_document_hierarchy_Tests.cs │ │ ├── Bug_1484_store_overloads_Tests.cs │ │ ├── IPolicy.cs │ │ ├── IVersioned.cs │ │ ├── LinuxPolicy.cs │ │ ├── OsPolicy.cs │ │ ├── PolicyType.cs │ │ ├── WindowsPolicy.cs │ │ ├── delete_by_where_for_hierarchy_Tests.cs │ │ ├── end_to_end_document_hierarchy_usage_Tests.cs │ │ ├── end_to_end_document_hierarchy_with_interface_tests.cs │ │ ├── persist_and_load_for_hierarchy_Tests.cs │ │ ├── query_through_mixed_population_Tests.cs │ │ └── query_through_mixed_population_multi_tenanted.cs │ ├── Indexes │ │ ├── NgramSearchTests.cs │ │ ├── UniqueIndexTests.cs │ │ ├── computed_indexes.cs │ │ ├── duplicated_field.cs │ │ ├── full_text_index.cs │ │ └── unique_indexes.cs │ ├── Internal │ │ └── Generated │ │ │ └── DocumentStorage │ │ │ └── RevisionedDocProvider1212098993.cs │ ├── Metadata │ │ ├── assigning_versions_to_documents.cs │ │ ├── created_timestamp_queries.cs │ │ ├── end_to_end_versioned_docs.cs │ │ ├── fetching_entity_metadata.cs │ │ ├── flexible_document_metadata.cs │ │ ├── getting_and_setting_headers.cs │ │ ├── last_modified_queries.cs │ │ ├── metadata_marker_interfaces.cs │ │ └── projecting_metadata_to_documents.cs │ ├── MultiTenancy │ │ ├── MultiTenancyFixture.cs │ │ ├── UniqueIndexMultiTenantTests.cs │ │ ├── conjoined_multi_tenancy.cs │ │ ├── conjoined_multi_tenancy_with_partitioning.cs │ │ ├── disabling_default_tenant_usage.cs │ │ └── mixed_single_and_conjoined_tenancy.cs │ ├── Operations │ │ └── TruncateTableTests.cs │ ├── Reading │ │ ├── BatchedQuerying │ │ │ ├── batched_querying_acceptance_Tests.cs │ │ │ ├── batched_querying_with_aggregate_functions.cs │ │ │ └── batched_querying_with_order_functions.cs │ │ ├── Json │ │ │ ├── document_session_find_json_Tests.cs │ │ │ ├── document_session_find_json_async_Tests.cs │ │ │ ├── get_raw_json_Tests.cs │ │ │ └── streaming_json_results.cs │ │ ├── Loading │ │ │ ├── document_session_load_already_loaded_document_Tests.cs │ │ │ ├── document_session_load_document.cs │ │ │ └── document_session_load_not_yet_persisted_document_Tests.cs │ │ ├── UserName.cs │ │ ├── advanced_sql_query.cs │ │ ├── query_by_sql.cs │ │ └── query_plans.cs │ ├── SessionMechanics │ │ ├── DocumentSession_change_set_tracking_Tests.cs │ │ ├── DocumentSession_disposal_locking.cs │ │ ├── StubDocumentSessionListener.cs │ │ ├── UnitOfWorkExtensions.cs │ │ ├── UnitOfWork_Operation_Ordering_Tests.cs │ │ ├── UnitOfWork_PendingChanges_Functionality_Tests.cs │ │ ├── Using_Global_DocumentSessionListener_Tests.cs │ │ ├── Using_Local_DocumentSessionListener_Tests.cs │ │ ├── dirty_tracked_sessions.cs │ │ ├── document_session_logs_SaveChanges.cs │ │ ├── ejecting_all_pending_changes.cs │ │ ├── ejecting_documents.cs │ │ ├── identity_map_mechanics.cs │ │ ├── reset_all_data_usage.cs │ │ ├── serializable_transactions.cs │ │ ├── session_timeouts.cs │ │ └── updating_by_batch.cs │ ├── TestSetup.cs │ ├── Writing │ │ ├── Identity │ │ │ ├── Sequences │ │ │ │ ├── Bug_1404_Hilo_concurrent_update_failure.cs │ │ │ │ ├── Bug_255_Hilo_table_being_erroneously_recreated.cs │ │ │ │ ├── CombGuidIdGenerationTests.cs │ │ │ │ ├── CustomKeyGenerationTests.cs │ │ │ │ ├── DocumentIdStrategyTests.cs │ │ │ │ ├── IdentityKeyGenerationTests.cs │ │ │ │ ├── Users.cs │ │ │ │ ├── hilo_configuration_overrides.cs │ │ │ │ └── hilo_tests.cs │ │ │ ├── auto_assign_missing_guid_ids_Tests.cs │ │ │ ├── private_identity_fields.cs │ │ │ ├── using_int_identity.cs │ │ │ ├── using_long_identity.cs │ │ │ ├── using_natural_identity_keys.cs │ │ │ └── using_string_identity.cs │ │ ├── bulk_loading.cs │ │ ├── document_inserts.cs │ │ ├── document_updates.cs │ │ └── storing_documents.cs │ ├── duplicate_document_type_alias_detection.cs │ └── persist_and_query_via_dynamic.cs ├── EventAppenderPerfTester │ ├── EventAppenderPerfTester.csproj │ ├── ExportCommand.cs │ ├── ITestPlan.cs │ ├── MultiplesTestPlan.cs │ ├── Program.cs │ ├── ReadCommand.cs │ ├── Results.md │ ├── SingleFileFetchForWritingPlan.cs │ ├── SingleFileSimplePlan.cs │ ├── TestCommand.cs │ ├── TestInput.cs │ ├── TestType.cs │ ├── TripStreamReaderWriter.cs │ └── data.json ├── EventPublisher │ ├── EventPublisher.csproj │ ├── Program.cs │ └── StatusBoard.cs ├── EventSourceWorker │ ├── EventSourceWorker.csproj │ ├── NewTripHandler.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Worker.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── EventSourcingTests │ ├── Aggregation │ │ ├── AggregationContext.cs │ │ ├── AggregationTestingSupport.cs │ │ ├── OrderAggregate.cs │ │ ├── aggregate_stream_into_samples.cs │ │ ├── aggregate_stream_returns_null_if_the_aggregate_is_null_at_that_point_in_stream.cs │ │ ├── aggregate_stream_samples.cs │ │ ├── aggregates_should_be_registered_as_document_mappings_automatically.cs │ │ ├── aggregation_projection_validation_rules.cs │ │ ├── blue_green_deployment_of_aggregates.cs │ │ ├── explicit_code_for_aggregation_logic.cs │ │ ├── querying_with_non_stale_data.cs │ │ ├── rebuilding_a_single_stream_projection.cs │ │ ├── setting_version_number_on_aggregate.cs │ │ ├── stream_compacting.cs │ │ ├── strong_typed_identifiers_on_aggregates_must_be_nullable.cs │ │ ├── time_travelling_samples.cs │ │ ├── using_apply_metadata.cs │ │ ├── using_event_filtering_within_inline_aggregations.cs │ │ ├── using_guid_based_strong_typed_id_for_aggregate_identity.cs │ │ ├── using_string_based_strong_typed_id_for_aggregate_identity.cs │ │ ├── when_doing_inline_per_stream_aggregations_with_Guid_stream_identity.cs │ │ ├── when_doing_live_aggregations.cs │ │ ├── when_finding_the_last_good_aggregation.cs │ │ ├── when_using_inline_lambdas_to_define_immutable_projection.cs │ │ ├── when_using_inline_lambdas_to_define_the_projection.cs │ │ └── write_to_aggregate.cs │ ├── AssemblyInfo.cs │ ├── Bugs │ │ ├── Bug_1019_event_type_not_found_bad_exception_message.cs │ │ ├── Bug_1069_using_generic_event_types_because_why_not.cs │ │ ├── Bug_1679_use_inner_type_for_stream_aggregation.cs │ │ ├── Bug_1723_inline_projections_get_cut_off.cs │ │ ├── Bug_1754_multiple_event_stream_creations_one_session.cs │ │ ├── Bug_1758_creating_stream_runs_extra_selects_and_deletes.cs │ │ ├── Bug_1781_inline_projection_foreign_key_constraint_failure.cs │ │ ├── Bug_2011_streams_should_be_getting_correct_timestamp.cs │ │ ├── Bug_2025_event_inheritance_in_projection.cs │ │ ├── Bug_2143_append_exclusive_then_append_throws_when_saving_changes.cs │ │ ├── Bug_2220_DeadLetterEvent_should_be_Feature_if_events_are_active.cs │ │ ├── Bug_2260_tombstone_events_violate_streamid_version_uniqueness.cs │ │ ├── Bug_2281_stream_action_without_events_save_changes_throws.cs │ │ ├── Bug_2289_tombstone_events_violate_seq_id_uniqueness.cs │ │ ├── Bug_2296_tenant_session_in_grouper.cs │ │ ├── Bug_2465_make_event_serialization_strategy_be_lazy.cs │ │ ├── Bug_2528_projections_should_handle_each_event_once.cs │ │ ├── Bug_2666_create_or_apply_but_not_both_should_apply.cs │ │ ├── Bug_2865_configuration_assertion_with_flat_table_projections.cs │ │ ├── Bug_2883_ievent_not_working_as_identity_source_in_multistream_projections.cs │ │ ├── Bug_2978_aggregate_projection_documents_are_not_optimistic_concurrency_event_with_that_policy.cs │ │ ├── Bug_3184_Projection_named_Projection.cs │ │ ├── Bug_3310_inline_projections_with_quick_append.cs │ │ ├── Bug_3643_using_struct_in_map_flattableprojection.cs │ │ ├── Bug_3661_await_custom_projection_slicing.cs │ │ ├── Bug_3665_compiling_with_private_members.cs │ │ ├── Bug_3769_query_for_non_stale_projection_with_custom_projection.cs │ │ ├── codegen_issue_with_IEvent.cs │ │ └── nulls_in_event_name_cache.cs │ ├── EventGraphTests.cs │ ├── EventMappingTests.cs │ ├── EventSequenceFetcherTests.cs │ ├── EventSourcingTests.csproj │ ├── EventStreamUnexpectedMaxEventIdExceptionTransformTest.cs │ ├── Examples │ │ ├── DaemonUsage.cs │ │ ├── ErrorHandling.cs │ │ ├── FetchLatest.cs │ │ ├── MigrationSamples.cs │ │ ├── MultiTenancyExamples.cs │ │ ├── Optimizations.cs │ │ ├── OptimizedCommandHandling.cs │ │ ├── Project.cs │ │ ├── SampleEventProjection.cs │ │ ├── StartStreamSamples.cs │ │ ├── TeleHealth │ │ │ ├── Board.cs │ │ │ ├── BoardViewProjection.cs │ │ │ └── TeleHealthSample.cs │ │ ├── TrackedEventProjection.cs │ │ ├── TripProjectionWithEventMetadata.cs │ │ ├── UsingInlineSideEffects.cs │ │ └── event_store_quickstart.cs │ ├── FakeAggregate.cs │ ├── FetchForWriting │ │ ├── fetch_latest_async_aggregate.cs │ │ ├── fetch_latest_inline_aggregate.cs │ │ ├── fetch_latest_live_aggregate.cs │ │ ├── fetching_async_aggregates_for_writing.cs │ │ ├── fetching_inline_aggregates_for_writing.cs │ │ └── fetching_live_aggregates_for_writing.cs │ ├── Json │ │ └── JsonSerializationTests.cs │ ├── Projections │ │ ├── AggregationProjectionTests.cs │ │ ├── CodeGeneration │ │ │ └── aggregation_with_event_type_hierarchy.cs │ │ ├── EventProjectionTests.cs │ │ ├── EventProjections │ │ │ └── EventProjectionOrderingTests.cs │ │ ├── Flattened │ │ │ ├── FlatTableProjectionTests.cs │ │ │ ├── StatementMapTests.cs │ │ │ ├── ValuesAdded.cs │ │ │ ├── ValuesDeleted.cs │ │ │ ├── ValuesSet.cs │ │ │ ├── ValuesSubtracted.cs │ │ │ ├── WriteTableWithGuidIdentifierProjection.cs │ │ │ ├── flat_table_projection_with_event_member_identifier_end_to_end.cs │ │ │ ├── flat_table_projection_with_stream_id_identifier_end_to_end.cs │ │ │ └── flat_table_projection_with_stream_key_identifier_end_to_end.cs │ │ ├── MonsterSlayed.cs │ │ ├── MultiStreamProjections │ │ │ ├── CustomGroupers │ │ │ │ ├── custom_grouper_with_document_session.cs │ │ │ │ ├── custom_grouper_with_events_transformation.cs │ │ │ │ └── custom_slicer.cs │ │ │ ├── TestClasses.cs │ │ │ ├── rolling_up_by_tenant.cs │ │ │ ├── simple_multi_stream_projection.cs │ │ │ └── simple_multi_stream_projection_wih_one_to_many.cs │ │ ├── MultiTenants │ │ │ └── ConjoinedTenancyProjectionsTests.cs │ │ ├── QuestMonsters.cs │ │ ├── QuestParty.cs │ │ ├── QuestPartyWithEvents.cs │ │ ├── SingleStreamProjectionTests.cs │ │ ├── custom_transformation_of_events.cs │ │ ├── hiearchy_projection.cs │ │ ├── include_extra_schema_objects_from_projections.cs │ │ ├── inline_aggregation_by_stream_with_multiples.cs │ │ ├── inline_aggregation_with_base_view_class.cs │ │ ├── inline_aggregation_with_custom_projection_configuration.cs │ │ ├── inline_aggregation_with_non_public_setter.cs │ │ ├── inline_aggregation_with_private_constructor.cs │ │ ├── inline_aggregation_with_subclass.cs │ │ ├── inline_transformation_of_events.cs │ │ ├── stream_aggregation.cs │ │ ├── testing_projections.cs │ │ ├── using_explicit_code_for_live_aggregation.cs │ │ ├── using_non_concrete_types_in_projections.cs │ │ └── when_registering_a_custom_projection_type.cs │ ├── QuestTypes.cs │ ├── QuickAppend │ │ ├── Examples.cs │ │ ├── QuestPartyWithStringIdentifier.cs │ │ ├── StringIdentifiedStreamsCollection.cs │ │ ├── StringIdentifiedStreamsFixture.cs │ │ ├── quick_append_end_to_end.cs │ │ ├── quick_append_event_capture_and_fetching_the_stream.cs │ │ ├── quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs │ │ ├── quick_append_events_with_optimistic_or_exclusive_locks.cs │ │ ├── quick_append_timestamp.cs │ │ └── quick_appending_events_workflow_specs.cs │ ├── ScenarioAggregateAndRepository.cs │ ├── ScenarioCopyAndReplaceStream.cs │ ├── SchemaChange │ │ ├── MultipleVersions │ │ │ ├── Classes │ │ │ │ ├── ClrUpcastConfiguration.cs │ │ │ │ ├── JsonNetUpcastConfiguration.cs │ │ │ │ └── SystemTextJsonUpcastConfiguration.cs │ │ │ ├── Lambdas │ │ │ │ ├── ClrUpcastConfiguration.cs │ │ │ │ ├── JsonNetUpcastConfiguration.cs │ │ │ │ └── SystemTextJsonUpcastConfiguration.cs │ │ │ ├── MultipleSchemaVersions.cs │ │ │ └── ShoppingCart.cs │ │ ├── NamespaceChange.cs │ │ ├── SimpleMappings.cs │ │ └── Upcasters.cs │ ├── Utils │ │ └── MultipleActionCheck.cs │ ├── aggregateto_linq_operator_tests.cs │ ├── append_events_with_optimistic_or_exclusive_locks.cs │ ├── appending_events_workflow_specs.cs │ ├── archiving_events.cs │ ├── asserting_on_expected_event_version_on_append.cs │ ├── building_events_and_streams_table_based_on_partitioning.cs │ ├── cannot_register_duplicate_projections_by_name.cs │ ├── cannot_start_a_stream_with_zero_events.cs │ ├── capturing_event_versions_on_existing_streams_after_append.cs │ ├── delete_single_event_stream.cs │ ├── end_to_end_event_capture_and_fetching_the_stream.cs │ ├── end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs │ ├── event_statistics.cs │ ├── event_store_with_string_identifiers_for_stream.cs │ ├── event_wrapper_must_be_serializable.cs │ ├── fetch_a_single_event_with_metadata.cs │ ├── fetching_event_store_floor_by_time.cs │ ├── fetching_stream_state.cs │ ├── flexible_event_metadata.cs │ ├── generating_event_store_descriptors.cs │ ├── get_committed_events_from_listener_Tests.cs │ ├── jasperfx_event_store_mechanics.cs │ ├── mandatory_stream_type_behavior.cs │ ├── marking_stream_as_isnew_on_capture.cs │ ├── multi_tenancy_and_event_capture.cs │ ├── no_prior_registration_of_the_event_types.cs │ ├── opting_into_index_on_event_id.cs │ ├── protecting_sensitive_data.cs │ ├── querying_event_data_with_linq.cs │ ├── removing_protected_information.cs │ ├── replacing_events.cs │ ├── schema_object_management.cs │ └── start_stream_should_enforce_that_it_is_a_new_stream.cs ├── EventStoreMigrations │ ├── EventStoreMigrations.csproj │ ├── Program.cs │ └── TestCommand.cs ├── FSharpTypes │ ├── FSharpTypes.fsproj │ └── Library.fs ├── IssueService │ ├── Controllers │ │ ├── IssueController.cs │ │ ├── JsonController.cs │ │ ├── PaymentController.cs │ │ └── ThingController.cs │ ├── IssueService.csproj │ ├── MartenSettings.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── appsettings.Development.json │ └── appsettings.json ├── LinqTests │ ├── Acceptance │ │ ├── Support │ │ │ ├── DefaultQueryFixture.cs │ │ │ ├── LinqTestCase.cs │ │ │ ├── LinqTestContext.cs │ │ │ ├── OrderedSelectComparison.cs │ │ │ ├── SelectTransform.cs │ │ │ ├── TargetComparison.cs │ │ │ └── TargetSchemaFixture.cs │ │ ├── against_date_time_offset.cs │ │ ├── casing_support.cs │ │ ├── chained_where_clauses.cs │ │ ├── child_collection_queries.cs │ │ ├── custom_identity_members.cs │ │ ├── custom_linq_extensions.cs │ │ ├── date_type_usage.cs │ │ ├── deep_searches.cs │ │ ├── diagnostic_methods.cs │ │ ├── dictionary_usage.cs │ │ ├── enum_usage.cs │ │ ├── equals_method_usage_validation.cs │ │ ├── identity_map_mechanics.cs │ │ ├── json_naming_attributes.cs │ │ ├── matches_sql_queries.cs │ │ ├── nested_boolean_logic.cs │ │ ├── null_or_not_null_querying.cs │ │ ├── nullable_types.cs │ │ ├── number_filtering.cs │ │ ├── order_by_clauses.cs │ │ ├── order_by_sql.cs │ │ ├── query_with_inheritance.cs │ │ ├── querying_against_timespan.cs │ │ ├── select_clause_usage.cs │ │ ├── select_clauses.cs │ │ ├── select_many.cs │ │ ├── statistics_and_paged_list.cs │ │ ├── string_filtering.cs │ │ ├── take_and_skip.cs │ │ ├── using_dynamic_props.cs │ │ ├── using_explicit_sql_in_select_clauses.cs │ │ ├── where_clauses.cs │ │ └── where_clauses_fsharp.cs │ ├── AssemblyInfo.cs │ ├── Bugs │ │ ├── Bug_1189_can_select_transform_without_an_id.cs │ │ ├── Bug_118_bad_exception_message_Tests.cs │ │ ├── Bug_1217_order_by_count_of_sub_collection.cs │ │ ├── Bug_1219_ordering_by_attributes.cs │ │ ├── Bug_1245_include_plus_full_text_search.cs │ │ ├── Bug_1256_querying_against_a_uint_type.cs │ │ ├── Bug_1325_Any_with_contains_on_IList_of_string.cs │ │ ├── Bug_1413_not_inside_of_where_against_child_collection.cs │ │ ├── Bug_1473_warn_about_custom_value_types_in_linq.cs │ │ ├── Bug_1683_query_against_dict_string_object.cs │ │ ├── Bug_1703_Equality_Not_Symmetric.cs │ │ ├── Bug_1851_need_to_recursively_reference_assemblies_in_generic_type_parameters_of_compiled_queries.cs │ │ ├── Bug_1875_duplicated_array_field_test.cs │ │ ├── Bug_1884_multi_tenancy_and_Any_query.cs │ │ ├── Bug_1886_compiled_query_value_retention.cs │ │ ├── Bug_1891_compiled_query_problem.cs │ │ ├── Bug_1951_querying_against_nested_enum.cs │ │ ├── Bug_2057_select_transform_dictionary.cs │ │ ├── Bug_2198_querying_against_UTC_DateTime_with_Npgsql.cs │ │ ├── Bug_2213_explanatory_exception_on_usage_of_coalescing_operator_in_select.cs │ │ ├── Bug_2223_list_contains_any_generates_invalid_sql.cs │ │ ├── Bug_2224_Include_needs_to_respect_Take_and_Skip_in_main_body.cs │ │ ├── Bug_2282_SOE_on_hiearchical_usage.cs │ │ ├── Bug_2383_contains_in_where_clause.cs │ │ ├── Bug_2433_include_with_take.cs │ │ ├── Bug_2553_Include_with_ToPagedList.cs │ │ ├── Bug_2563_sub_collection_queries_and_OR.cs │ │ ├── Bug_260_Take_Skip_with_Select_Tests.cs │ │ ├── Bug_2618_Include_with_AnyTenant.cs │ │ ├── Bug_261_double_take_or_skip.cs │ │ ├── Bug_2649_select_and_distinct_string_with_ordering.cs │ │ ├── Bug_276_Query_by_abstract_type_in_hierarchy.cs │ │ ├── Bug_2810_distinct_plus_include.cs │ │ ├── Bug_2850_missed_field_reducing.cs │ │ ├── Bug_2895_no_stack_overflow_please.cs │ │ ├── Bug_2896_count_plus_HashSet.cs │ │ ├── Bug_2934_multiple_nested_conditionals.cs │ │ ├── Bug_2935_any_contains_in_child_collection.cs │ │ ├── Bug_2936_static_list.cs │ │ ├── Bug_2937_string_isnullorempty_being_ignored.cs │ │ ├── Bug_2946_querying_on_value_collection_of_enums_serialized_as_string.cs │ │ ├── Bug_3003_negation_and_list_of_guids.cs │ │ ├── Bug_3017_SelectMany_with_LongCount.cs │ │ ├── Bug_3024_wildcards_in_string_insensitive_comparisons.cs │ │ ├── Bug_3027_using_string_null_check.cs │ │ ├── Bug_3030_nested_array_queries.cs │ │ ├── Bug_3031_querying_using_soft_deletes.cs │ │ ├── Bug_3032_serialization_error_combined_Select_and_Include.cs │ │ ├── Bug_3035_crazy_nested_boolean_conditions.cs │ │ ├── Bug_3065_include_query_with_conjoined_tenancy.cs │ │ ├── Bug_3066_calling_static_methods_in_queries.cs │ │ ├── Bug_3067_nested_array_in_dictionary.cs │ │ ├── Bug_3082_trouble_with_repeated_include_usage.cs │ │ ├── Bug_3087_using_JsonPath_with_MatchesSql.cs │ │ ├── Bug_3096_include_where_select.cs │ │ ├── Bug_3116_more_expression_to_constant_issues.cs │ │ ├── Bug_3117_select_directly_to_DateTime.cs │ │ ├── Bug_3126_dictionary_nested_queries.cs │ │ ├── Bug_3151_using_duplicated_fields_in_linq_queries.cs │ │ ├── Bug_3337_select_page.cs │ │ ├── Bug_3350_Select_with_deep_accessor.cs │ │ ├── Bug_3351_Include_with_ToPagedListAsync.cs │ │ ├── Bug_337_certain_boolean_searches_are_not_using_searchable_field.cs │ │ ├── Bug_3610_enum_array_as_string_in_compiled_query.cs │ │ ├── Bug_365_compiled_query_with_constant_fails.cs │ │ ├── Bug_432_querying_with_UTC_times_with_offset.cs │ │ ├── Bug_449_IsOneOf_query_with_enum_types.cs │ │ ├── Bug_479_select_datetime_fields.cs │ │ ├── Bug_484_Contains_on_IList_of_string.cs │ │ ├── Bug_490_hierarchy_and_include.cs │ │ ├── Bug_503_query_on_null_complex_object.cs │ │ ├── Bug_504_Take_Skip_before_Select_not_applying_sort_or_where_clause.cs │ │ ├── Bug_561_negation_of_query_on_contains.cs │ │ ├── Bug_582_and_592_Skip_and_Take_in_compiled_queries.cs │ │ ├── Bug_605_unary_expressions_in_where_clause_of_compiled_query.cs │ │ ├── Bug_606_string_contains_starts_or_ends_with_in_compiled_queries.cs │ │ ├── Bug_634_include_against_soft_deleted_docs.cs │ │ ├── Bug_717_permutation_of_Linq_queries.cs │ │ ├── Bug_784_Collection_Contains_within_compiled_query.cs │ │ ├── Bug_834_querying_inside_of_child_collections.cs │ │ ├── Bug_854_multiple_or_expressions_softdelete_tenancy_filters_appended_incorrectly.cs │ │ ├── Bug_899_operations_out_of_order_when_types_use_inheritance.cs │ │ ├── Bug_997_or_queries_with_hierarchical_docs.cs │ │ ├── Bug_using_literal_false_in_where_clause.cs │ │ ├── child_parent_inclusion_bug.cs │ │ ├── compiled_query_problem_with_includes_and_ICompiledQuery_reuse.cs │ │ ├── compiled_query_problem_with_nested_properties.cs │ │ ├── hashset_contains.cs │ │ └── query_with_order_by.cs │ ├── ChildCollections │ │ ├── ChildTestClasses.cs │ │ ├── count_for_child_collections.cs │ │ ├── query_against_child_collections.cs │ │ ├── query_with_inner_query_with_CollectionToArrayJsonConverter_onProperty.cs │ │ ├── query_with_inner_query_with_global_CollectionStorage_WithArray.cs │ │ └── querying_through_n_deep_sub_collections.cs │ ├── Compiled │ │ ├── compiled_queries.cs │ │ ├── compiled_query_by_string_fragments.cs │ │ └── validating_and_making_unique_query_class.cs │ ├── Includes │ │ ├── end_to_end_query_with_compiled_include.cs │ │ ├── end_to_end_query_with_include.cs │ │ ├── includes_with_custom_mapping.cs │ │ └── includes_with_filtering_on_included_documents.cs │ ├── Internals │ │ ├── BoolNotVisitorTests.cs │ │ ├── ComparisonBetweenFieldsFragmentTests.cs │ │ ├── ComparisonFilterTests.cs │ │ ├── DuplicatedFieldTests.cs │ │ ├── ExpressionExtensionsTests.cs │ │ ├── IsNullAndNotNullFilterTests.cs │ │ ├── NotWhereFragmentTests.cs │ │ └── SimpleExpressionTests.cs │ ├── LinqTests.csproj │ ├── Operators │ │ ├── aggregate_functions.cs │ │ ├── all_operator.cs │ │ ├── any_operator.cs │ │ ├── async_enumerable.cs │ │ ├── count_operator.cs │ │ ├── custom_marten_operators.cs │ │ ├── distinct_operator.cs │ │ ├── first_operator.cs │ │ ├── is_empty_operator.cs │ │ ├── is_one_of_operator.cs │ │ ├── is_subset_of_operator.cs │ │ ├── is_super_set_of_operator.cs │ │ ├── last_operator.cs │ │ ├── modulo_operator.cs │ │ ├── negation_operator.cs │ │ ├── single_operator.cs │ │ ├── string_compare_operator.cs │ │ └── to_list_operator.cs │ ├── SimpleUser.cs │ ├── SoftDeletes │ │ └── query_with_multiple_where_clauses_and_soft_deletes_configured.cs │ ├── TestSetup.cs │ ├── Usings.cs │ ├── playing.cs │ └── using_containment_operator_in_linq_Tests.cs ├── LinqTestsTypes │ └── LinqTestsTypes.csproj ├── Marten.AspNetCore.Testing │ ├── AppFixture.cs │ ├── AssemblyInfo.cs │ ├── Bug_2311_honoring_multi_tenancy_in_streaming.cs │ ├── Examples │ │ ├── MultipleMartenDatabasesIntegrationContext.cs │ │ ├── SimplifiedIntegrationContext.cs │ │ └── web_service_streaming_tests.cs │ ├── IntegrationCollection.cs │ ├── IntegrationContext.cs │ ├── Marten.AspNetCore.Testing.csproj │ ├── using_strong_typed_identifiers.cs │ └── web_service_streaming_tests.cs ├── Marten.AspNetCore │ ├── Daemon │ │ └── AsyncDaemonHealthCheckExtensions.cs │ ├── Marten.AspNetCore.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── QueryableExtensions.cs ├── Marten.CommandLine.Tests │ ├── Marten.CommandLine.Tests.csproj │ ├── ProjectionControllerTests.cs │ └── Usings.cs ├── Marten.NodaTime.Testing │ ├── Acceptance │ │ └── noda_time_acceptance.cs │ ├── AssemblyInfo.cs │ ├── Bug_2307_JObject_in_dictionary_duplicated_field.cs │ ├── Marten.NodaTime.Testing.csproj │ └── TestData │ │ └── TargetWithDates.cs ├── Marten.NodaTime │ ├── Marten.NodaTime.csproj │ └── NodaTimeExtensions.cs ├── Marten.Testing.OtherAssembly │ ├── Bug1851 │ │ ├── GenericOuter.cs │ │ └── StoredObjectInOtherAssembly.cs │ ├── Bug1984 │ │ └── GenericEntity.cs │ ├── DeeperNamespace │ │ └── BaseDocumentWithId.cs │ ├── Marten.Testing.OtherAssembly.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── ShortGuid.cs ├── Marten.Testing.ThirdAssembly │ ├── Bug1984 │ │ └── Data.cs │ └── Marten.Testing.ThirdAssembly.csproj ├── Marten.Testing │ ├── App.config │ ├── AssemblyInfo.cs │ ├── CodeTracker │ │ ├── ActiveProject.cs │ │ ├── BigBangRecorder.cs │ │ ├── CommitView.cs │ │ ├── Events.cs │ │ ├── GithubDataRecorder.cs │ │ ├── GithubProject.cs │ │ ├── IssueState.cs │ │ └── UserAction.cs │ ├── DevelopmentModeRegistry.cs │ ├── DocumentStoreExtensions.cs │ ├── Documents │ │ ├── Account.cs │ │ ├── Company.cs │ │ ├── CriticalIssue.cs │ │ ├── GuidDoc.cs │ │ ├── IntDoc.cs │ │ ├── InvalidDocument.cs │ │ ├── Issue.cs │ │ ├── LongDoc.cs │ │ ├── SingleTenantedDocument.cs │ │ ├── StringDoc.cs │ │ ├── Target.cs │ │ ├── TargetIntId.cs │ │ ├── User.cs │ │ └── UserWithInheritedId.cs │ ├── Examples │ │ ├── CompiledQuerySamples.cs │ │ ├── ConfiguringDatabaseSchemaName.cs │ │ ├── ConfiguringDocumentStore.cs │ │ ├── DDLCustomization.cs │ │ ├── Deletes.cs │ │ ├── DiagnosticsExamples.cs │ │ ├── DocumentCleanerExamples.cs │ │ ├── ErrorHandling.cs │ │ ├── ExplicitTransactions.cs │ │ ├── ExportingDDL.cs │ │ ├── FlatTableProjection.cs │ │ ├── ForeignKeyExamples.cs │ │ ├── IdExamples.cs │ │ ├── IdentityMapTests.cs │ │ ├── InExamples.cs │ │ ├── IsOneOfExamples.cs │ │ ├── LinqExamples.cs │ │ ├── Load_by_Id.cs │ │ ├── MartenRegistryExamples.cs │ │ ├── MetadataUsage.cs │ │ ├── MigrationSamples.cs │ │ ├── MultiPropertyCalculatedIndexExamples.cs │ │ ├── MultiTenancy.cs │ │ ├── OpeningAQuerySession.cs │ │ ├── OpeningASessionAsync.cs │ │ ├── OtelSamples.cs │ │ ├── Policies.cs │ │ ├── QueryBySql.cs │ │ ├── RebuildRunner.cs │ │ ├── RecordingLogger.cs │ │ ├── RevisionedDocuments.cs │ │ ├── SagaStorageExample.cs │ │ ├── ScenarioUsingSequenceForUniqueId.cs │ │ ├── Searching_Within_Child_Collections.cs │ │ ├── Setting_Timestamp_on_all_changes_by_base_class_Tests.cs │ │ ├── SimpleSessionListener.cs │ │ ├── StoringDocuments.cs │ │ ├── UnitOfWorkBlogSamples.cs │ │ └── UnitOfWorkMechanics.cs │ ├── Github │ │ ├── Documents.cs │ │ ├── GhRepository.cs │ │ ├── GhUser.cs │ │ ├── GitHubExporter.cs │ │ ├── RepositoryHistory.cs │ │ ├── bottles.json │ │ ├── fubucore.json │ │ ├── fubumvc.json │ │ ├── htmltags.json │ │ ├── storyteller.json │ │ └── structuremap.json │ ├── GlobalSuppressions.cs │ ├── Harness │ │ ├── BugIntegrationContext.cs │ │ ├── ConnectionSource.cs │ │ ├── DefaultStoreFixture.cs │ │ ├── DestructiveIntegrationContext.cs │ │ ├── IntegrationContext.cs │ │ ├── OneOffConfigurationsContext.cs │ │ ├── PgVersionTargetedFact.cs │ │ ├── SerializerTypeTargetedFact.cs │ │ ├── SerializerTypeTargetedTheory.cs │ │ ├── SpecificationExtensions.cs │ │ ├── StoreContext.cs │ │ ├── StoreFixture.cs │ │ ├── TestOutputMartenLogger.cs │ │ └── TestsSettings.cs │ ├── Marten.Testing.csproj │ ├── MartenHostEnvironment.cs │ ├── RecordingLogger.cs │ ├── SchemaMigrationExtensions.cs │ ├── StubDocumentSessionListener.cs │ ├── TestSetup.cs │ └── Weird │ │ └── Task.cs ├── Marten.sln ├── Marten │ ├── AdvancedOperations.cs │ ├── BulkInsertMode.cs │ ├── DefaultMartenLogger.cs │ ├── DocumentStore.CompiledQueryCollection.cs │ ├── DocumentStore.EventStore.cs │ ├── DocumentStore.IMartenStorage.cs │ ├── DocumentStore.MultiTenancy.cs │ ├── DocumentStore.cs │ ├── DocumentTracking.cs │ ├── Events │ │ ├── AggregateToExtensions.cs │ │ ├── Aggregation │ │ │ ├── CustomProjection.cs │ │ │ ├── IAggregateGrouper.cs │ │ │ ├── IMartenAggregateProjection.cs │ │ │ ├── IMessageBatch.cs │ │ │ ├── IMessageOutbox.cs │ │ │ ├── NulloMessageOutbox.cs │ │ │ └── SingleStreamProjection.cs │ │ ├── Archiving │ │ │ ├── AllEventsFilter.cs │ │ │ ├── ArchiveStreamFunction.cs │ │ │ ├── ArchiveStreamOperation.cs │ │ │ ├── ArchivedEventExtensions.cs │ │ │ ├── IArchiveFilter.cs │ │ │ ├── IsArchivedColumn.cs │ │ │ ├── IsArchivedFilter.cs │ │ │ ├── IsNotArchivedFilter.cs │ │ │ └── MaybeArchivedMethodCallParser.cs │ │ ├── AsyncProjectionTestingExtensions.cs │ │ ├── CodeGeneration │ │ │ ├── CodeGenerationExtensions.cs │ │ │ ├── EventDocumentStorageGenerator.cs │ │ │ └── MartenIgnoreAttribute.cs │ │ ├── Daemon │ │ │ ├── AsyncOptionsExtensions.cs │ │ │ ├── Coordination │ │ │ │ ├── AdvisoryLock.cs │ │ │ │ ├── IProjectionCoordinator.cs │ │ │ │ ├── IProjectionDistributor.cs │ │ │ │ ├── IProjectionSet.cs │ │ │ │ ├── MultiTenantedProjectionDistributor.cs │ │ │ │ ├── ProjectionCoordinator.cs │ │ │ │ ├── ProjectionSet.cs │ │ │ │ ├── SingleTenantProjectionDistributor.cs │ │ │ │ └── SoloProjectionDistributor.cs │ │ │ ├── HighWater │ │ │ │ ├── GapDetector.cs │ │ │ │ ├── HighWaterDetector.cs │ │ │ │ └── HighWaterStatisticsDetector.cs │ │ │ ├── Internals │ │ │ │ ├── AggregateTypeFilter.cs │ │ │ │ ├── BlockExtensions.cs │ │ │ │ ├── EventLoader.cs │ │ │ │ ├── EventLoaderException.cs │ │ │ │ ├── EventRangeExtensions.cs │ │ │ │ ├── EventTypeFilter.cs │ │ │ │ ├── ProjectionBatch.cs │ │ │ │ ├── ProjectionDocumentSession.cs │ │ │ │ ├── ProjectionUpdateBatch.cs │ │ │ │ └── ResilientEventLoader.cs │ │ │ ├── Progress │ │ │ │ ├── DeleteProjectionProgress.cs │ │ │ │ ├── InsertProjectionProgress.cs │ │ │ │ ├── ProjectionProgressStatement.cs │ │ │ │ ├── ShardStateSelector.cs │ │ │ │ └── UpdateProjectionProgress.cs │ │ │ └── ProjectionDaemon.cs │ │ ├── EventDocumentStorage.cs │ │ ├── EventGraph.Actions.cs │ │ ├── EventGraph.FeatureSchema.cs │ │ ├── EventGraph.GeneratesCode.cs │ │ ├── EventGraph.Masking.cs │ │ ├── EventGraph.Processing.cs │ │ ├── EventGraph.cs │ │ ├── EventMapping.cs │ │ ├── EventQueryMapping.cs │ │ ├── EventSequenceFetcher.cs │ │ ├── EventStatement.cs │ │ ├── EventStore.Append.cs │ │ ├── EventStore.Archiving.cs │ │ ├── EventStore.ConcurrentAppends.cs │ │ ├── EventStore.FetchForWriting.cs │ │ ├── EventStore.StartStream.cs │ │ ├── EventStore.StreamCompacting.cs │ │ ├── EventStore.WriteToAggregate.cs │ │ ├── EventStore.cs │ │ ├── EventStoreStatistics.cs │ │ ├── Fetching │ │ │ ├── FetchAsyncPlan.cs │ │ │ ├── FetchInlinedPlan.cs │ │ │ ├── FetchLivePlan.cs │ │ │ ├── IFetchPlanner.cs │ │ │ ├── IdentityForwardingAggregator.cs │ │ │ ├── InlineFetchPlanner.cs │ │ │ └── LiveFetchPlanner.cs │ │ ├── IEventAppender.cs │ │ ├── IEventOperations.cs │ │ ├── IEventStorage.cs │ │ ├── IEventStoreOperations.cs │ │ ├── IEventStoreOptions.cs │ │ ├── IEventStream.cs │ │ ├── IQueryEventStore.cs │ │ ├── IReadOnlyEventStoreOptions.cs │ │ ├── IsArchivedMember.cs │ │ ├── LinqExtensions.cs │ │ ├── MetadataConfig.cs │ │ ├── Operations │ │ │ ├── AppendEventOperationBase.cs │ │ │ ├── EstablishTombstoneStream.cs │ │ │ ├── IncrementStreamVersionById.cs │ │ │ ├── IncrementStreamVersionByKey.cs │ │ │ ├── InsertStreamBase.cs │ │ │ ├── QuickAppendEventsOperationBase.cs │ │ │ └── UpdateStreamVersion.cs │ │ ├── Projections │ │ │ ├── EventProjection.cs │ │ │ ├── Examples.cs │ │ │ ├── Flattened │ │ │ │ ├── ColumnMapType.cs │ │ │ │ ├── DecrementMap.cs │ │ │ │ ├── EventDeleter.cs │ │ │ │ ├── EventForwarder.cs │ │ │ │ ├── FlatTableProjection.Validation.cs │ │ │ │ ├── FlatTableProjection.cs │ │ │ │ ├── FlatTableUpsertFunction.cs │ │ │ │ ├── IColumnMap.cs │ │ │ │ ├── IEventHandler.cs │ │ │ │ ├── IParameterSetter.cs │ │ │ │ ├── IncrementMap.cs │ │ │ │ ├── KebabConverter.cs │ │ │ │ ├── MemberMap.cs │ │ │ │ ├── ParameterSetter.cs │ │ │ │ ├── RelayParameterSetter.cs │ │ │ │ ├── SchemaNameSource.cs │ │ │ │ ├── SetValueMap.cs │ │ │ │ ├── SqlOperation.cs │ │ │ │ └── StatementMap.cs │ │ │ ├── IMartenRegistrable.cs │ │ │ ├── IProjection.cs │ │ │ ├── IProjectionSchemaSource.cs │ │ │ ├── MultiStreamProjection.cs │ │ │ ├── ProjectionDocumentPolicy.cs │ │ │ ├── ProjectionLifecycle.cs │ │ │ └── ProjectionOptions.cs │ │ ├── Protected │ │ │ ├── EventDataMasking.cs │ │ │ ├── OverwriteEventOperation.cs │ │ │ └── ReplaceEventOperation.cs │ │ ├── QueryEventStore.cs │ │ ├── Querying │ │ │ ├── SingleEventQueryHandler.cs │ │ │ └── StreamStateSelector.cs │ │ ├── QuickEventAppender.cs │ │ ├── RichEventAppender.cs │ │ ├── Schema │ │ │ ├── EventJsonDataColumn.cs │ │ │ ├── EventMetadataCollection.cs │ │ │ ├── EventProgressionTable.cs │ │ │ ├── EventTableColumn.cs │ │ │ ├── EventTypeColumn.cs │ │ │ ├── EventsTable.cs │ │ │ ├── IEventTableColumn.cs │ │ │ ├── QuickAppendEventFunction.cs │ │ │ ├── SequenceColumn.cs │ │ │ ├── StreamIdColumn.cs │ │ │ ├── StreamsTable.cs │ │ │ └── VersionColumn.cs │ │ ├── StreamState.cs │ │ └── TestSupport │ │ │ ├── ProjectionScenario.Assertions.cs │ │ │ ├── ProjectionScenario.EventOperations.cs │ │ │ ├── ProjectionScenario.cs │ │ │ ├── ProjectionScenarioException.cs │ │ │ ├── ScenarioAction.cs │ │ │ ├── ScenarioAssertion.cs │ │ │ └── ScenarioStep.cs │ ├── Exceptions │ │ ├── AmbiguousDocumentTypeAliasesException.cs │ │ ├── ApplyEventException.cs │ │ ├── BadLinqExpressionException.cs │ │ ├── ConcurrentUpdateException.cs │ │ ├── DefaultTenantUsageDisabledException.cs │ │ ├── DocumentAlreadyExistsException.cs │ │ ├── DocumentIdTypeMismatchException.cs │ │ ├── EventDeserializationFailureException.cs │ │ ├── ExistingStreamIdCollisionException.cs │ │ ├── HiloSequenceAdvanceToNextHiAttemptsExceededException.cs │ │ ├── InvalidCompiledQueryException.cs │ │ ├── InvalidConnectionStringException.cs │ │ ├── InvalidDocumentException.cs │ │ ├── InvalidStreamOperationException.cs │ │ ├── InvalidTenantForDatabaseException.cs │ │ ├── InvalidUtcDateTimeUsageException.cs │ │ ├── MartenCommandException.cs │ │ ├── MartenCommandNotSupportedException.cs │ │ ├── MartenException.cs │ │ ├── MartenExceptionTransformer.cs │ │ ├── MartenNotSupportedException.cs │ │ ├── MartenSchemaException.cs │ │ ├── NonExistentDocumentException.cs │ │ ├── NonExistentStreamException.cs │ │ ├── RollbackException.cs │ │ ├── StreamLockedException.cs │ │ ├── StreamTypeMissingException.cs │ │ └── UnknownEventTypeException.cs │ ├── FullTextIndexAttribute.cs │ ├── HostExtensions.cs │ ├── IAdvancedSql.cs │ ├── IDiagnostics.cs │ ├── IDocumentOperations.cs │ ├── IDocumentPolicy.cs │ ├── IDocumentSchemaResolver.cs │ ├── IDocumentSession.cs │ ├── IDocumentSessionListener.cs │ ├── IDocumentStore.cs │ ├── IJsonLoader.cs │ ├── IMartenLogger.cs │ ├── IMartenStorage.cs │ ├── IQueryPlan.cs │ ├── IQuerySession.cs │ ├── IReadOnlyStoreOptions.cs │ ├── ISerializer.cs │ ├── ISessionFactory.cs │ ├── ITenantOperations.cs │ ├── ITenantQueryOperations.cs │ ├── Internal │ │ ├── CodeGeneration │ │ │ ├── BulkLoader.cs │ │ │ ├── BulkLoaderBuilder.cs │ │ │ ├── DocumentFunctionOperationBuilder.cs │ │ │ ├── DocumentOperations.cs │ │ │ ├── DocumentProviderBuilder.cs │ │ │ ├── DocumentSelectorWithDirtyChecking.cs │ │ │ ├── DocumentSelectorWithIdentityMap.cs │ │ │ ├── DocumentSelectorWithOnlySerializer.cs │ │ │ ├── DocumentSelectorWithVersions.cs │ │ │ ├── DocumentStorageBuilder.cs │ │ │ ├── FrameCollectionExtensions.cs │ │ │ ├── IDocumentSelector.cs │ │ │ ├── SelectorBuilder.cs │ │ │ ├── StorageStyle.cs │ │ │ ├── StringExtensions.cs │ │ │ └── SubClassBulkLoader.cs │ │ ├── CompiledQueries │ │ │ ├── ClonedCompiledQuery.cs │ │ │ ├── CommandPlan.cs │ │ │ ├── CompiledQueryCodeFile.cs │ │ │ ├── CompiledQueryPlan.cs │ │ │ ├── CompiledQuerySource.cs │ │ │ ├── CompiledQuerySourceBuilder.cs │ │ │ ├── CompiledSourceType.cs │ │ │ ├── ComplexCompiledQuery.cs │ │ │ ├── EnumParameterFinder.cs │ │ │ ├── FieldQueryMember.cs │ │ │ ├── ICompiledQueryAwareFilter.cs │ │ │ ├── ICompiledQuerySource.cs │ │ │ ├── IParameterFinder.cs │ │ │ ├── IQueryMember.cs │ │ │ ├── ParameterUsage.cs │ │ │ ├── PropertyQueryMember.cs │ │ │ ├── QueryCompiler.cs │ │ │ ├── QueryMember.cs │ │ │ ├── SimpleParameterFinder.cs │ │ │ ├── StatelessCompiledQuery.cs │ │ │ └── UniqueValueSource.cs │ │ ├── DirtyTracking │ │ │ ├── ChangeTracker.cs │ │ │ └── IChangeTracker.cs │ │ ├── IMartenSession.cs │ │ ├── IProviderGraph.cs │ │ ├── IUpdateBatch.cs │ │ ├── OpenTelemetry │ │ │ └── MartenTracing.cs │ │ ├── Operations │ │ │ ├── ExecuteSqlStorageOperation.cs │ │ │ ├── IDocumentStorageOperation.cs │ │ │ ├── IStorageOperation.cs │ │ │ ├── OperationRole.cs │ │ │ ├── StorageOperation.cs │ │ │ └── TruncateTable.cs │ │ ├── ProviderGraph.cs │ │ ├── SecondaryStoreConfig.cs │ │ ├── Sessions │ │ │ ├── AmbientTransactionLifetime.cs │ │ │ ├── AutoClosingLifetime.cs │ │ │ ├── DirtyCheckingDocumentSession.cs │ │ │ ├── DocumentSessionBase.Deletes.cs │ │ │ ├── DocumentSessionBase.HardDeletes.cs │ │ │ ├── DocumentSessionBase.ProjectionStorage.cs │ │ │ ├── DocumentSessionBase.SaveChanges.cs │ │ │ ├── DocumentSessionBase.cs │ │ │ ├── EventTracingConnectionLifetime.cs │ │ │ ├── ExternalTransaction.cs │ │ │ ├── IConnectionLifetime.cs │ │ │ ├── IdentityMapDocumentSession.cs │ │ │ ├── LightweightSession.cs │ │ │ ├── NestedTenantQuerySession.cs │ │ │ ├── NestedTenantSession.cs │ │ │ ├── OperationPage.cs │ │ │ ├── QuerySession.AdvancedSql.cs │ │ │ ├── QuerySession.ChangeTracking.cs │ │ │ ├── QuerySession.Disposal.cs │ │ │ ├── QuerySession.Execution.cs │ │ │ ├── QuerySession.FullTextSearch.cs │ │ │ ├── QuerySession.Json.cs │ │ │ ├── QuerySession.Load.cs │ │ │ ├── QuerySession.Metadata.cs │ │ │ ├── QuerySession.Querying.cs │ │ │ ├── QuerySession.Storage.cs │ │ │ ├── QuerySession.Tenancy.cs │ │ │ ├── QuerySession.cs │ │ │ ├── ReadOnlyTransactionalConnection.cs │ │ │ └── TransactionalConnection.cs │ │ ├── Storage │ │ │ ├── DataAndIdSelectClause.cs │ │ │ ├── DirtyCheckedDocumentStorage.cs │ │ │ ├── DocumentStorage.cs │ │ │ ├── IDocumentStorage.cs │ │ │ ├── IdentityMapDocumentStorage.cs │ │ │ ├── LightweightDocumentStorage.cs │ │ │ ├── QueryOnlyDocumentStorage.cs │ │ │ └── SubClassDocumentStorage.cs │ │ ├── TenantDataCleaner.cs │ │ ├── UnitOfWork.cs │ │ ├── UpdateBatch.cs │ │ ├── ValueTypeElementMember.cs │ │ ├── ValueTypeIdentifiedDocumentStorage.cs │ │ ├── VersionTracker.cs │ │ └── WalkReferencedAssemblies.cs │ ├── JsonLoader.cs │ ├── Linq │ │ ├── CollectionUsage.Compilation.cs │ │ ├── CollectionUsage.Includes.cs │ │ ├── CollectionUsage.Parsing.cs │ │ ├── CollectionUsage.cs │ │ ├── ConfigureExplainExpressions.cs │ │ ├── CreatedAt │ │ │ ├── CreatedAtExtensions.cs │ │ │ ├── CreatedBeforeParser.cs │ │ │ └── CreatedSinceParser.cs │ │ ├── FetchType.cs │ │ ├── ICompiledQuery.cs │ │ ├── IConfigureExplainExpressions.cs │ │ ├── ILinqQuery.cs │ │ ├── IMartenQueryable.cs │ │ ├── Includes │ │ │ ├── DictionaryIncludePlan.cs │ │ │ ├── IIncludePlan.cs │ │ │ ├── IIncludeReader.cs │ │ │ ├── IMartenQueryableIncludeBuilder.cs │ │ │ ├── IdInIncludedDocumentIdentifierFilter.cs │ │ │ ├── Include.cs │ │ │ ├── IncludePlan.cs │ │ │ ├── IncludeQueryHandler.cs │ │ │ ├── IncludeReader.cs │ │ │ ├── ListIncludePlan.cs │ │ │ ├── MartenQueryableIncludeBuilder.cs │ │ │ ├── PassthroughSelectStatement.cs │ │ │ └── TemporaryTableStatement.cs │ │ ├── LastModified │ │ │ ├── LastModifiedExtensions.cs │ │ │ ├── ModifiedBeforeParser.cs │ │ │ └── ModifiedSinceParser.cs │ │ ├── MartenLinqQueryProvider.cs │ │ ├── MartenLinqQueryable.cs │ │ ├── MatchesSql │ │ │ ├── MatchesSqlExtensions.cs │ │ │ └── MatchesSqlParser.cs │ │ ├── Members │ │ │ ├── BooleanMember.cs │ │ │ ├── ChildCollectionCount.cs │ │ │ ├── ChildCollectionJsonPathCountFilter.cs │ │ │ ├── ChildCollectionMember.cs │ │ │ ├── ChildCollectionWhereClause.cs │ │ │ ├── ChildDocument.cs │ │ │ ├── CollectionLengthMember.cs │ │ │ ├── DateTimeMember.cs │ │ │ ├── DateTimeOffsetMember.cs │ │ │ ├── Dictionaries │ │ │ │ ├── DictionaryContainsKey.cs │ │ │ │ ├── DictionaryContainsKeyFilter.cs │ │ │ │ ├── DictionaryCountMember.cs │ │ │ │ ├── DictionaryIsEmpty.cs │ │ │ │ ├── DictionaryIsNotEmpty.cs │ │ │ │ ├── DictionaryItemMember.cs │ │ │ │ ├── DictionaryKeysMember.cs │ │ │ │ ├── DictionaryMember.cs │ │ │ │ ├── DictionaryValuesContainFilter.cs │ │ │ │ ├── DictionaryValuesMember.cs │ │ │ │ ├── IDictionaryMember.cs │ │ │ │ └── KeyValuePairMemberCollection.cs │ │ │ ├── DocumentQueryableMemberCollection.cs │ │ │ ├── DuplicatedArrayField.cs │ │ │ ├── DuplicatedField.cs │ │ │ ├── EnumAsIntegerMember.cs │ │ │ ├── EnumAsStringMember.cs │ │ │ ├── FSharpOptionValueTypeMember.cs │ │ │ ├── HasValueMember.cs │ │ │ ├── IBooleanMember.cs │ │ │ ├── ICollectionMember.cs │ │ │ ├── IComparableMember.cs │ │ │ ├── IHasChildrenMembers.cs │ │ │ ├── IMemberSource.cs │ │ │ ├── IQueryableMember.cs │ │ │ ├── IQueryableMemberCollection.cs │ │ │ ├── IdMember.cs │ │ │ ├── ModuloComparison.cs │ │ │ ├── NotMember.cs │ │ │ ├── QueryableMember.cs │ │ │ ├── ScalarSelectManyStatement.cs │ │ │ ├── ScalarSelectManyStringStatement.cs │ │ │ ├── SimpleCastMember.cs │ │ │ ├── StringMember.cs │ │ │ ├── StringValueTypeMember.cs │ │ │ ├── StrongTypedIdMember.cs │ │ │ ├── ValueCollections │ │ │ │ ├── ArrayIndexMember.cs │ │ │ │ ├── ElementComparisonFilter.cs │ │ │ │ ├── ElementMember.cs │ │ │ │ ├── IValueCollectionMember.cs │ │ │ │ ├── SelectManyValueCollection.cs │ │ │ │ ├── SimpleElementMember.cs │ │ │ │ └── ValueCollectionMember.cs │ │ │ ├── ValueTypeMember.cs │ │ │ └── WholeDataMember.cs │ │ ├── OrderingDirection.cs │ │ ├── Parsing │ │ │ ├── CompareToComparable.cs │ │ │ ├── IMethodCallParser.cs │ │ │ ├── JsonPathCreator.cs │ │ │ ├── LinqInternalExtensions.cs │ │ │ ├── LinqQueryParser.Handlers.cs │ │ │ ├── LinqQueryParser.Preview.cs │ │ │ ├── LinqQueryParser.Statements.cs │ │ │ ├── LinqQueryParser.cs │ │ │ ├── MemberFinder.cs │ │ │ ├── Methods │ │ │ │ ├── AllMethodParser.cs │ │ │ │ ├── AnySubQueryParser.cs │ │ │ │ ├── AnyTenant.cs │ │ │ │ ├── EnumerableContains.cs │ │ │ │ ├── FullText │ │ │ │ │ ├── FullTextSearchMethodCallParser.cs │ │ │ │ │ ├── NgramSearch.cs │ │ │ │ │ ├── PhraseSearch.cs │ │ │ │ │ ├── PlainTextSearch.cs │ │ │ │ │ ├── Search.cs │ │ │ │ │ └── WebStyleSearch.cs │ │ │ │ ├── IsEmpty.cs │ │ │ │ ├── IsNotOneOf.cs │ │ │ │ ├── IsOneOf.cs │ │ │ │ ├── IsSubsetOf.cs │ │ │ │ ├── IsSupersetOf.cs │ │ │ │ ├── SimpleEqualsParser.cs │ │ │ │ ├── SimpleNotEqualsParser.cs │ │ │ │ ├── Strings │ │ │ │ │ ├── EqualsIgnoreCaseParser.cs │ │ │ │ │ ├── StringComparisonParser.cs │ │ │ │ │ ├── StringContains.cs │ │ │ │ │ ├── StringEndsWith.cs │ │ │ │ │ ├── StringEquals.cs │ │ │ │ │ ├── StringIsNullOrEmpty.cs │ │ │ │ │ ├── StringIsNullOrWhiteSpace.cs │ │ │ │ │ └── StringStartsWith.cs │ │ │ │ └── TenantIsOneOf.cs │ │ │ ├── Operators │ │ │ │ ├── AnyOperator.cs │ │ │ │ ├── CasingRule.cs │ │ │ │ ├── DistinctOperator.cs │ │ │ │ ├── IncludeOperator.cs │ │ │ │ ├── IncludePlanOperator.cs │ │ │ │ ├── LastOperator.cs │ │ │ │ ├── LinqOperator.cs │ │ │ │ ├── OperatorLibrary.cs │ │ │ │ ├── OrderBySqlOperator.cs │ │ │ │ ├── Ordering.cs │ │ │ │ ├── OrderingOperator.cs │ │ │ │ ├── SelectManyOperator.cs │ │ │ │ ├── SelectOperator.cs │ │ │ │ ├── SingleValueOperator.cs │ │ │ │ ├── SkipOperator.cs │ │ │ │ ├── TakeOperator.cs │ │ │ │ └── WhereOperator.cs │ │ │ ├── SelectParser.cs │ │ │ ├── SelectorVisitor.cs │ │ │ ├── SimpleExpression.cs │ │ │ ├── SingleValueMode.cs │ │ │ ├── StringCompareComparable.cs │ │ │ └── WhereClauseParser.cs │ │ ├── QueryHandlers │ │ │ ├── AdvancedSqlQueryHandler.cs │ │ │ ├── IQueryHandler.cs │ │ │ ├── LinqConstants.cs │ │ │ ├── ListQueryHandler.cs │ │ │ ├── ListWithStatsQueryHandler.cs │ │ │ ├── LoadByIdArrayHandler.cs │ │ │ ├── LoadByIdHandler.cs │ │ │ ├── OneResultHandler.cs │ │ │ └── UserSuppliedQueryHandler.cs │ │ ├── QueryPlan.cs │ │ ├── QueryStatistics.cs │ │ ├── Selectors │ │ │ ├── CastingSelector.cs │ │ │ ├── ISelector.cs │ │ │ ├── SerializationSelector.cs │ │ │ └── TimeSpanSelector.cs │ │ ├── SoftDeletes │ │ │ ├── DeletedBeforeParser.cs │ │ │ ├── DeletedSinceParser.cs │ │ │ ├── IsDeletedParser.cs │ │ │ ├── IsSoftDeletedMember.cs │ │ │ ├── MaybeDeletedParser.cs │ │ │ └── SoftDeletedExtensions.cs │ │ ├── SqlGeneration │ │ │ ├── AnySelectClause.cs │ │ │ ├── CountClause.cs │ │ │ ├── DataSelectClause.cs │ │ │ ├── Deletion.cs │ │ │ ├── DistinctSelectionStatement.cs │ │ │ ├── ExplodeCollectionStatement.cs │ │ │ ├── FilterStatement.cs │ │ │ ├── Filters │ │ │ │ ├── AllValuesAreNullFilter.cs │ │ │ │ ├── AllValuesEqualFilter.cs │ │ │ │ ├── BooleanFieldIsFalse.cs │ │ │ │ ├── BooleanFieldIsTrue.cs │ │ │ │ ├── ByIdFilter.cs │ │ │ │ ├── CollectionIsEmpty.cs │ │ │ │ ├── CollectionIsNotEmpty.cs │ │ │ │ ├── ContainmentWhereFilter.cs │ │ │ │ ├── CurrentTenantFilter.cs │ │ │ │ ├── DeepCollectionIsNotEmpty.cs │ │ │ │ ├── EqualsFilter.cs │ │ │ │ ├── ExcludeSoftDeletedFilter.cs │ │ │ │ ├── FullTextWhereFragment.cs │ │ │ │ ├── ICollectionAware.cs │ │ │ │ ├── ITenantFilter.cs │ │ │ │ ├── IsNotNullFilter.cs │ │ │ │ ├── IsNullFilter.cs │ │ │ │ ├── MemberComparisonFilter.cs │ │ │ │ ├── SpecificTenantFilter.cs │ │ │ │ ├── SubQueryFilter.cs │ │ │ │ ├── TenantIsOneOfFilter.cs │ │ │ │ └── WriteSerializedJsonParameterFrame.cs │ │ │ ├── FromFragment.cs │ │ │ ├── HardDelete.cs │ │ │ ├── IOperationFragment.cs │ │ │ ├── IScalarSelectClause.cs │ │ │ ├── ISelectClause.cs │ │ │ ├── Literal.cs │ │ │ ├── NewScalarSelectClause.cs │ │ │ ├── NewScalarStringSelectClause.cs │ │ │ ├── OrderByFragment.cs │ │ │ ├── ScalarSelectClause.cs │ │ │ ├── ScalarStringSelectClause.cs │ │ │ ├── SelectDataSelectClause.cs │ │ │ ├── SelectorStatement.cs │ │ │ ├── SoftDelete.cs │ │ │ ├── Statement.WhereParsing.cs │ │ │ ├── Statement.cs │ │ │ ├── StatementMode.cs │ │ │ ├── StatementOperation.cs │ │ │ ├── StatsSelectClause.cs │ │ │ ├── UnSoftDelete.cs │ │ │ ├── ValueTypeSelectClause.cs │ │ │ └── WhereFragmentExtensions.cs │ │ └── notes.md │ ├── LinqExtensions.cs │ ├── LinqParsing.cs │ ├── Marten.csproj │ ├── MartenRegistry.cs │ ├── MartenServiceCollectionExtensions.cs │ ├── MartenSystemPart.cs │ ├── Metadata │ │ ├── IRevisioned.cs │ │ ├── ISoftDeleted.cs │ │ ├── ITenanted.cs │ │ ├── ITracked.cs │ │ ├── IVersioned.cs │ │ ├── SoftDeletedPolicy.cs │ │ ├── TenancyPolicy.cs │ │ ├── TrackedPolicy.cs │ │ └── VersionedPolicy.cs │ ├── NulloLogger.cs │ ├── NulloMartenLogger.cs │ ├── Pagination │ │ ├── IPagedList.cs │ │ ├── PagedList.cs │ │ └── PagedListQueryableExtensions.cs │ ├── PartitioningExpression.cs │ ├── Patching │ │ ├── IPatchExpression.cs │ │ ├── PatchExpression.cs │ │ ├── PatchOperation.cs │ │ ├── PatchingExtensions.cs │ │ └── RemoveAction.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── QuerySessionExtensions.cs │ ├── QueryableExtensions.cs │ ├── Schema │ │ ├── Arguments │ │ │ ├── CurrentVersionArgument.cs │ │ │ ├── DocJsonBodyArgument.cs │ │ │ ├── DocTypeArgument.cs │ │ │ ├── DotNetTypeArgument.cs │ │ │ ├── RevisionArgument.cs │ │ │ ├── TenantIdArgument.cs │ │ │ ├── UpsertArgument.cs │ │ │ └── VersionArgument.cs │ │ ├── BulkLoading │ │ │ └── IBulkLoader.cs │ │ ├── ColumnValue.cs │ │ ├── ComputedIndex.cs │ │ ├── DatabaseGenerator.cs │ │ ├── DatabaseSchemaNameAttribute.cs │ │ ├── DdlTemplateAttribute.cs │ │ ├── DeleteStyle.cs │ │ ├── DoNotPartitionAttribute.cs │ │ ├── DocumentAliasAttribute.cs │ │ ├── DocumentForeignKey.cs │ │ ├── DocumentIndex.cs │ │ ├── DocumentMapping.cs │ │ ├── DocumentMetadataCollection.cs │ │ ├── DocumentSchema.cs │ │ ├── DuplicateFieldAttribute.cs │ │ ├── ForeignKeyAttribute.cs │ │ ├── ForeignKeyConstraint.cs │ │ ├── GinIndexedAttribute.cs │ │ ├── HiLoSequenceAttribute.cs │ │ ├── IDatabaseCreationExpressions.cs │ │ ├── IDocumentCleaner.cs │ │ ├── IDocumentMapping.cs │ │ ├── IInitialData.cs │ │ ├── ITenantDatabaseCreationExpressions.cs │ │ ├── Identity │ │ │ ├── CombGuidIdGeneration.cs │ │ │ ├── FSharpDiscriminatedUnionIdGeneration.cs │ │ │ ├── GuidIdGeneration.cs │ │ │ ├── IIdGeneration.cs │ │ │ ├── NoOpIdGeneration.cs │ │ │ ├── Sequences │ │ │ │ ├── HiLoSequence.cs │ │ │ │ ├── HiloIdGeneration.cs │ │ │ │ ├── HiloSettings.cs │ │ │ │ ├── ISequence.cs │ │ │ │ ├── ISequences.cs │ │ │ │ ├── IdentityKeyGeneration.cs │ │ │ │ └── SequenceFactory.cs │ │ │ ├── StringIdGeneration.cs │ │ │ └── ValueTypeIdGeneration.cs │ │ ├── IdentityAttribute.cs │ │ ├── IndexedCreatedAtAttribute.cs │ │ ├── IndexedLastModifiedAttribute.cs │ │ ├── Indexing │ │ │ ├── FullText │ │ │ │ └── FullTextIndexDefinitionFactory.cs │ │ │ └── Unique │ │ │ │ └── TenancyScope.cs │ │ ├── InsertExceptionTransform.cs │ │ ├── MartenAttribute.cs │ │ ├── MartenDocumentAttribute.cs │ │ ├── MartenEventAttribute.cs │ │ ├── MartenManagedTenantListPartitions.cs │ │ ├── MetadataAttributes.cs │ │ ├── MultiTenantedAttribute.cs │ │ ├── NgramIndex.cs │ │ ├── PropertySearching.cs │ │ ├── PropertySearchingAttribute.cs │ │ ├── SQL │ │ │ ├── mt_get_next_hi.sql │ │ │ ├── mt_grams_array.sql │ │ │ ├── mt_grams_query.sql │ │ │ ├── mt_grams_vector.sql │ │ │ ├── mt_immutable_date.sql │ │ │ ├── mt_immutable_time.sql │ │ │ ├── mt_immutable_timestamp.sql │ │ │ ├── mt_immutable_timestamptz.sql │ │ │ ├── mt_jsonb_append.sql │ │ │ ├── mt_jsonb_copy.sql │ │ │ ├── mt_jsonb_duplicate.sql │ │ │ ├── mt_jsonb_fix_null_parent.sql │ │ │ ├── mt_jsonb_increment.sql │ │ │ ├── mt_jsonb_insert.sql │ │ │ ├── mt_jsonb_move.sql │ │ │ ├── mt_jsonb_patch.sql │ │ │ ├── mt_jsonb_path_to_array.sql │ │ │ ├── mt_jsonb_remove.sql │ │ │ ├── mt_mark_event_progression.sql │ │ │ └── mt_safe_unaccent.sql │ │ ├── SchemaBuilder.cs │ │ ├── SchemaConstants.cs │ │ ├── SchemaObjects.sql │ │ ├── SingleTenantedAttribute.cs │ │ ├── SoftDeletedAttribute.cs │ │ ├── StructuralTypedAttribute.cs │ │ ├── SubClassMapping.cs │ │ ├── SubClasses.cs │ │ ├── UniqueIndexAttribute.cs │ │ ├── UniqueIndexType.cs │ │ ├── UseOptimisticConcurrencyAttribute.cs │ │ └── VersionAttribute.cs │ ├── Services │ │ ├── BatchQuerying │ │ │ ├── BatchQueryItem.cs │ │ │ ├── BatchedOrderedQueryable.cs │ │ │ ├── BatchedQuery.cs │ │ │ ├── BatchedQueryable.cs │ │ │ ├── BatchedQueryableIncludeBuilder.cs │ │ │ ├── IBatchLoadByKeys.cs │ │ │ ├── IBatchQueryItem.cs │ │ │ ├── IBatchedFetcher.cs │ │ │ ├── IBatchedOrderedQueryable.cs │ │ │ ├── IBatchedQuery.cs │ │ │ ├── IBatchedQueryable.cs │ │ │ ├── IBatchedQueryableIncludeBuilder.cs │ │ │ └── TransformedBatchQueryable.cs │ │ ├── CommandRunnerExtensions.cs │ │ ├── CommandRunnerMode.cs │ │ ├── Diagnostics.cs │ │ ├── EventStreamUnexpectedMaxEventIdExceptionTransform.cs │ │ ├── IChangeSet.cs │ │ ├── IDeletion.cs │ │ ├── ISessionWorkTracker.cs │ │ ├── ISingleQueryHandler.cs │ │ ├── ISingleQueryRunner.cs │ │ ├── IUnitOfWork.cs │ │ ├── Json │ │ │ ├── JsonNetCollectionToArrayJsonConverter.cs │ │ │ ├── JsonNetContractResolver.cs │ │ │ ├── JsonNetObjectContractProvider.cs │ │ │ ├── SerializerFactory.cs │ │ │ ├── SerializerOptions.cs │ │ │ ├── SerializerType.cs │ │ │ ├── SystemObjectNewtonsoftCompatibleConverter.cs │ │ │ ├── SystemTextJsonBigIntegerConverter.cs │ │ │ ├── SystemTextJsonExtensions.cs │ │ │ └── Transformations │ │ │ │ ├── EventUpcaster.cs │ │ │ │ ├── JsonNet │ │ │ │ ├── EventUpcaster.cs │ │ │ │ └── JsonTransformations.cs │ │ │ │ ├── JsonTransformation.cs │ │ │ │ └── SystemTextJson │ │ │ │ ├── EventUpcaster.cs │ │ │ │ └── JsonTransformations.cs │ │ ├── JsonArrayPool.cs │ │ ├── JsonNetSerializer.cs │ │ ├── JsonStreamingExtensions.cs │ │ ├── MartenActivator.cs │ │ ├── NoDataReturnedCall.cs │ │ ├── OpenTelemetryOptions.cs │ │ ├── SessionOptions.cs │ │ ├── SystemTextJsonSerializer.cs │ │ └── VersionTracker.cs │ ├── Sessions │ │ ├── DefaultSessionFactory.cs │ │ ├── DirtyTrackedSessionFactory.cs │ │ ├── IdentitySessionFactory.cs │ │ ├── LightweightSessionFactory.cs │ │ └── TenantedSessionFactory.cs │ ├── Storage │ │ ├── BulkInsertion.cs │ │ ├── CompositeDocumentCleaner.cs │ │ ├── DataColumn.cs │ │ ├── DefaultTenancy.cs │ │ ├── DocumentTable.cs │ │ ├── DuplicatedFieldColumn.cs │ │ ├── IMartenDatabase.cs │ │ ├── ISelectableColumn.cs │ │ ├── ITenancy.cs │ │ ├── IdColumn.cs │ │ ├── InsertFunction.cs │ │ ├── MartenDatabase.DocumentCleaner.cs │ │ ├── MartenDatabase.EventStorage.cs │ │ ├── MartenDatabase.Execution.cs │ │ ├── MartenDatabase.cs │ │ ├── MasterTableTenancy.cs │ │ ├── MasterTableTenancyOptions.cs │ │ ├── Metadata │ │ │ ├── CausationIdColumn.cs │ │ │ ├── CorrelationIdColumn.cs │ │ │ ├── CreatedAtColumn.cs │ │ │ ├── DeletedAtColumn.cs │ │ │ ├── DocumentMetadata.cs │ │ │ ├── DocumentTypeColumn.cs │ │ │ ├── DotNetTypeColumn.cs │ │ │ ├── EntityMetadataQueryHandler.cs │ │ │ ├── HeadersColumn.cs │ │ │ ├── LastModifiedByColumn.cs │ │ │ ├── LastModifiedColumn.cs │ │ │ ├── MetadataColumn.cs │ │ │ ├── RevisionColumn.cs │ │ │ ├── SoftDeletedColumn.cs │ │ │ ├── TenantIdColumn.cs │ │ │ └── VersionColumn.cs │ │ ├── OriginWriter.cs │ │ ├── OverwriteFunction.cs │ │ ├── SingleServerMultiTenancy.cs │ │ ├── StandinDatabase.cs │ │ ├── StaticMultiTenancy.cs │ │ ├── StorageFeatures.cs │ │ ├── SystemFunction.cs │ │ ├── SystemFunctions.cs │ │ ├── Tenancy.cs │ │ ├── TenancyStyle.cs │ │ ├── Tenant2.cs │ │ ├── UpdateFunction.cs │ │ └── UpsertFunction.cs │ ├── StoreOptions.GeneratesCode.cs │ ├── StoreOptions.Identity.cs │ ├── StoreOptions.MemberFactory.cs │ ├── StoreOptions.Registration.cs │ ├── StoreOptions.cs │ ├── Subscriptions │ │ ├── ISubscription.cs │ │ ├── SubscriptionBase.cs │ │ └── SubscriptionWrapper.cs │ └── Util │ │ ├── CommandExtensions.cs │ │ ├── GenericsExtensions.cs │ │ ├── ReflectionExtensions.cs │ │ ├── ResilientPipelineBuilderExtensions.cs │ │ ├── SOHSkippingStream.cs │ │ ├── SharedBuffer.cs │ │ ├── StreamExtensions.cs │ │ └── StringExtensions.cs ├── MartenBenchmarks │ ├── BenchAgainst │ │ ├── BenchModel.cs │ │ ├── BenchModel2.cs │ │ ├── BenchModel3.cs │ │ └── BenchModel4.cs │ ├── BenchmarkStore.cs │ ├── BulkLoading.cs │ ├── DocumentActions.cs │ ├── EventActions.cs │ ├── Infrastructure │ │ └── StringToTextReaderExtensions.cs │ ├── LinqActions.cs │ ├── MartenBenchmarks.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── MemoryUsageChecker │ ├── MemoryUsageChecker.csproj │ └── Program.cs ├── MultiDatabaseCommandLineRunner │ ├── MultiDatabaseCommandLineRunner.csproj │ └── Program.cs ├── MultiHostTests │ ├── 00_init.sql │ ├── MultiHostConfigurationContext.cs │ ├── MultiHostTests.cs │ ├── MultiHostTests.csproj │ └── docker-compose.yaml ├── MultiTenancyTests │ ├── AssemblyInfo.cs │ ├── DocumentStore_IMartenStorage_implementation.cs │ ├── GlobalUsings.cs │ ├── MultiTenancyTests.csproj │ ├── SingleServerMultiTenancyTests.cs │ ├── marten_managed_tenant_id_partitioning.cs │ ├── using_database_per_tenant.cs │ ├── using_master_table_multi_tenancy.cs │ ├── using_master_table_multi_tenancy_with_datasource.cs │ ├── using_per_database_multitenancy.cs │ └── using_static_database_multitenancy.cs ├── NuGet.Config ├── PatchingTests │ ├── Patching │ │ ├── Bug_1173_patch_typenamehandling_bug.cs │ │ ├── Bug_2170_patch_with_sub_collection_query.cs │ │ ├── Bug_2460_parallel_patching.cs │ │ ├── Bug_3261_patch_plus_revisions.cs │ │ ├── Bug_593_patch_doc_function_should_be_built_in_designated_schema.cs │ │ ├── PatchExpressionTests.cs │ │ ├── multi_tenancy.cs │ │ ├── patching_api.cs │ │ └── patching_with_altered_metadata_columns.cs │ └── PatchingTests.csproj ├── StressTests │ ├── Bugs │ │ ├── Bug_3113_do_not_reorder_sql_operations.cs │ │ └── Bug_616_not_possible_to_use_Serializable_transactions.cs │ ├── StressTests.csproj │ ├── ability_to_use_an_existing_connection_and_transaction.cs │ ├── create_database_Tests.cs │ ├── reset_all_data_usage_ihost.cs │ └── using_multiple_document_stores_in_same_host.cs ├── TestSetup.cs ├── TestingSupport │ └── TestingSupport.csproj ├── ValueTypeTests │ ├── AssemblyInfo.cs │ ├── Bugs │ │ └── querying_by_value_types.cs │ ├── Internal │ │ └── Generated │ │ │ └── DocumentStorage │ │ │ ├── ClassProvider1873568694.cs │ │ │ ├── GradeProvider907442297.cs │ │ │ ├── Invoice2Provider479877131.cs │ │ │ ├── Invoice3Provider479877132.cs │ │ │ ├── InvoiceProvider1724721064.cs │ │ │ ├── OrderProvider347010495.cs │ │ │ ├── ReferenceTypeOrderProvider1892982689.cs │ │ │ ├── TeacherProvider944571072.cs │ │ │ ├── Team2Provider1170066519.cs │ │ │ ├── Team3Provider396017422.cs │ │ │ └── TeamProvider700129768.cs │ ├── StrongTypedId │ │ ├── fsharp_discriminated_union_document_operations.cs │ │ ├── guid_based_document_operations.cs │ │ ├── int_based_document_operations.cs │ │ ├── linq_querying_with_value_types.cs │ │ ├── long_based_document_operations.cs │ │ └── string_id_document_operations.cs │ ├── TestingTypes.cs │ ├── ValueTypeTests.csproj │ ├── VogenIds │ │ ├── guid_based_document_operations.cs │ │ ├── int_based_document_operations.cs │ │ ├── linq_querying_with_value_types.cs │ │ ├── long_based_document_operations.cs │ │ └── string_id_document_operations.cs │ ├── applicability_of_identity_types.cs │ ├── include_usage.cs │ ├── linq_querying_with_value_types.cs │ ├── notes.md │ └── registration.cs ├── docker-compose.dcproj ├── docker-compose.yml ├── launchSettings.json └── samples │ ├── AspireHeadlessTripService │ ├── AspireHeadlessTripService.csproj │ └── Program.cs │ ├── AspireHost │ ├── AspireHost.csproj │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── appsettings.Development.json │ └── appsettings.json │ ├── DocSamples │ ├── DocSamples.csproj │ ├── EventSourcingQuickstart.cs │ └── GlobalUsings.cs │ ├── EventSourcingIntro │ ├── EventSourcingIntro.csproj │ └── Program.cs │ ├── Helpdesk │ ├── Helpdesk.Api.Tests │ │ ├── Helpdesk.Api.Tests.csproj │ │ ├── Incidents │ │ │ ├── AcknowledgeResolutionIncidentTests.cs │ │ │ ├── AssignAgentTests.cs │ │ │ ├── CategoriseIncidentTests.cs │ │ │ ├── CloseIncidentTests.cs │ │ │ ├── Fixtures │ │ │ │ ├── ApiWithAcknowledgedIncident.cs │ │ │ │ ├── ApiWithLoggedIncident.cs │ │ │ │ ├── ApiWithResolvedIncident.cs │ │ │ │ └── Scenarios.cs │ │ │ ├── LogIncidentsTests.cs │ │ │ ├── PrioritiseIncidentTests.cs │ │ │ ├── RecordAgentResponseToIncidentTests.cs │ │ │ ├── RecordCustomerResponseToIncidentTests.cs │ │ │ └── ResolveIncidentTests.cs │ │ └── Settings.cs │ ├── Helpdesk.Api │ │ ├── .dockerignore │ │ ├── Core │ │ │ ├── Http │ │ │ │ └── ETagExtensions.cs │ │ │ ├── Kafka │ │ │ │ └── KafkaProducer.cs │ │ │ ├── Marten │ │ │ │ └── DocumentSessionExtensions.cs │ │ │ └── SignalR │ │ │ │ └── SignalRProducer.cs │ │ ├── Dockerfile │ │ ├── Helpdesk.Api.csproj │ │ ├── Incidents │ │ │ ├── GetCustomerIncidentsSummary │ │ │ │ └── IncidentSummary.cs │ │ │ ├── GetIncidentDetails │ │ │ │ └── IncidentDetails.cs │ │ │ ├── GetIncidentHistory │ │ │ │ └── IncidentHistory.cs │ │ │ ├── GetIncidentShortInfo │ │ │ │ └── IncidentShortInfo.cs │ │ │ ├── Incident.cs │ │ │ └── IncidentService.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── appsettings.Development.json │ │ ├── appsettings.Production.json │ │ └── appsettings.json │ ├── Helpdesk.sln │ ├── README.md │ └── docker-compose.yml │ └── MinimalAPI │ ├── MinimalAPI.csproj │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── appsettings.Development.json │ └── appsettings.json └── test ├── mocha.opts └── test_mt_patching.js /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.sh eol=lf 3 | *.png binary 4 | *.ttf binary 5 | *.jpg binary 6 | *.jpeg binary 7 | *.pdf binary 8 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [JasperFx] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # eventsourcingnetcore 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "MD024": false, 3 | "MD013": false, 4 | "MD026": false, 5 | "MD031": false, 6 | "MD033": false, 7 | "MD046": false 8 | } 9 | -------------------------------------------------------------------------------- /.markdownlintrc: -------------------------------------------------------------------------------- 1 | { 2 | "MD024": false, 3 | "MD013": false, 4 | "MD026": false, 5 | "MD031": false, 6 | "MD033": false, 7 | "MD046": false 8 | } 9 | -------------------------------------------------------------------------------- /.nuke/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./build.schema.json", 3 | "Solution": "src/Marten.sln" 4 | } 5 | -------------------------------------------------------------------------------- /assets/mdsnippet-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/assets/mdsnippet-sample.png -------------------------------------------------------------------------------- /benchmarks/1.3/BulkLoading-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Gen 0=834.5588 Allocated=7.74 MB 9 | 10 | Method | Mean | StdDev | 11 | -------------------- |------------ |---------- | 12 | BulkInsertDocuments | 197.7231 ms | 5.4325 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/1.3/BulkLoading-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Gen 0=834.5588 Allocated=7.74 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | -------------------- |------------ |---------- | 14 | BulkInsertDocuments | 197.7231 ms | 5.4325 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/1.3/BulkLoading-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | BulkInsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,197.7231 ms,5.4325 ms,834.5588,7.74 MB 3 | -------------------------------------------------------------------------------- /benchmarks/1.3/DocumentActions-report-default.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/benchmarks/1.3/DocumentActions-report-default.md -------------------------------------------------------------------------------- /benchmarks/1.3/DocumentActions-report-github.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/benchmarks/1.3/DocumentActions-report-github.md -------------------------------------------------------------------------------- /benchmarks/1.3/DocumentActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | InsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,43.7957 ms,2.6786 ms,287.5000,4.62 MB 3 | -------------------------------------------------------------------------------- /benchmarks/1.3/EventActions-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Allocated=1.88 MB 9 | 10 | Method | Mean | StdDev | 11 | ------------- |----------- |---------- | 12 | AppendEvents | 41.1983 ms | 1.1924 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/1.3/EventActions-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Allocated=1.88 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | ------------- |----------- |---------- | 14 | AppendEvents | 41.1983 ms | 1.1924 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/1.3/EventActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Allocated 2 | AppendEvents,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,41.1983 ms,1.1924 ms,1.88 MB 3 | -------------------------------------------------------------------------------- /benchmarks/1.3/LinqActions-report-github.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/benchmarks/1.3/LinqActions-report-github.md -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/BulkLoading-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Gen 0=834.5588 Allocated=7.74 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | -------------------- |------------ |---------- | 14 | BulkInsertDocuments | 196.4910 ms | 9.4850 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/BulkLoading-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | BulkInsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,196.4910 ms,9.4850 ms,834.5588,7.74 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/DocumentActions-report-default.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/benchmarks/2.0.baseline/results/DocumentActions-report-default.md -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/DocumentActions-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Gen 0=415.7609 Allocated=4.46 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | ---------------- |----------- |---------- | 14 | InsertDocuments | 43.0381 ms | 1.5788 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/DocumentActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | InsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,43.0381 ms,1.5788 ms,415.7609,4.46 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/EventActions-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Allocated=1.88 MB 9 | 10 | Method | Mean | StdDev | 11 | ------------- |----------- |---------- | 12 | AppendEvents | 44.3330 ms | 0.8700 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/EventActions-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Allocated=1.88 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | ------------- |----------- |---------- | 14 | AppendEvents | 44.3330 ms | 0.8700 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/EventActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Allocated 2 | AppendEvents,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,44.3330 ms,0.8700 ms,1.88 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.baseline/results/LinqActions-report-github.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/benchmarks/2.0.baseline/results/LinqActions-report-github.md -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/BulkLoading-report-default.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/benchmarks/2.0.fastexpressioncompiler/results/BulkLoading-report-default.md -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/BulkLoading-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Gen 0=1014.4231 Allocated=7.74 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | -------------------- |------------ |---------- | 14 | BulkInsertDocuments | 188.1269 ms | 8.5848 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/BulkLoading-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | BulkInsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,188.1269 ms,8.5848 ms,1014.4231,7.74 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/DocumentActions-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Gen 0=187.5000 Allocated=4.48 MB 9 | 10 | Method | Mean | StdDev | 11 | ---------------- |----------- |---------- | 12 | InsertDocuments | 43.6080 ms | 0.8464 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/DocumentActions-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Gen 0=187.5000 Allocated=4.48 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | ---------------- |----------- |---------- | 14 | InsertDocuments | 43.6080 ms | 0.8464 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/DocumentActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | InsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,43.6080 ms,0.8464 ms,187.5000,4.48 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/EventActions-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Allocated=1.88 MB 9 | 10 | Method | Mean | StdDev | 11 | ------------- |----------- |---------- | 12 | AppendEvents | 44.7526 ms | 1.0882 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/2.0.fastexpressioncompiler/results/EventActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Allocated 2 | AppendEvents,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,44.7526 ms,1.0882 ms,1.88 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/BulkLoading-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Gen 0=805.1471 Allocated=7.74 MB 9 | 10 | Method | Mean | StdDev | 11 | -------------------- |------------ |---------- | 12 | BulkInsertDocuments | 203.5752 ms | 8.5671 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/BulkLoading-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | BulkInsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,203.5752 ms,8.5671 ms,805.1471,7.74 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/DocumentActions-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Gen 0=287.5000 Allocated=4.48 MB 9 | 10 | Method | Mean | StdDev | 11 | ---------------- |----------- |---------- | 12 | InsertDocuments | 43.2947 ms | 1.7796 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/DocumentActions-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Gen 0=287.5000 Allocated=4.48 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | ---------------- |----------- |---------- | 14 | InsertDocuments | 43.2947 ms | 1.7796 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/DocumentActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Gen 0,Allocated 2 | InsertDocuments,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,43.2947 ms,1.7796 ms,287.5000,4.48 MB 3 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/EventActions-report-default.md: -------------------------------------------------------------------------------- 1 | 2 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 3 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 4 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 5 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 6 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | 8 | WarmupCount=2 Allocated=1.88 MB 9 | 10 | Method | Mean | StdDev | 11 | ------------- |----------- |---------- | 12 | AppendEvents | 44.6766 ms | 0.9392 ms | 13 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/EventActions-report-github.md: -------------------------------------------------------------------------------- 1 | ``` ini 2 | 3 | BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.1.7601 Service Pack 1 4 | Processor=Intel(R) Core(TM) i7-4980HQ CPU 2.80GHz, ProcessorCount=4 5 | Frequency=10000000 Hz, Resolution=100.0000 ns, Timer=UNKNOWN 6 | [Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 7 | Job-DNINOD : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1076.0 8 | 9 | WarmupCount=2 Allocated=1.88 MB 10 | 11 | ``` 12 | Method | Mean | StdDev | 13 | ------------- |----------- |---------- | 14 | AppendEvents | 44.6766 ms | 0.9392 ms | 15 | -------------------------------------------------------------------------------- /benchmarks/2.0.newtonsoft.upgrade/results/EventActions-report.csv: -------------------------------------------------------------------------------- 1 | Method,Job,AnalyzeLaunchVariance,EvaluateOverhead,MaxStdErrRelative,MinInvokeCount,MinIterationTime,RemoveOutliers,Affinity,Jit,Platform,Runtime,AllowVeryLargeObjects,Concurrent,CpuGroups,Force,Server,Clock,EngineFactory,Toolchain,InvocationCount,IterationTime,LaunchCount,RunStrategy,TargetCount,UnrollFactor,WarmupCount,Mean,StdDev,Allocated 2 | AppendEvents,Default,False,Default,Default,Default,Default,Default,15,RyuJit,X64,Clr,False,True,False,True,False,Default,Default,Default,1,Default,Default,Default,Default,16,2,44.6766 ms,0.9392 ms,1.88 MB 3 | -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | :; set -eo pipefail 2 | :; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) 3 | :; ${SCRIPT_DIR}/build.sh "$@" 4 | :; exit $? 5 | 6 | @ECHO OFF 7 | powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* 8 | -------------------------------------------------------------------------------- /build/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | dotnet_style_qualification_for_field = false:warning 3 | dotnet_style_qualification_for_property = false:warning 4 | dotnet_style_qualification_for_method = false:warning 5 | dotnet_style_qualification_for_event = false:warning 6 | dotnet_style_require_accessibility_modifiers = never:warning 7 | 8 | csharp_style_expression_bodied_methods = true:silent 9 | csharp_style_expression_bodied_properties = true:warning 10 | csharp_style_expression_bodied_indexers = true:warning 11 | csharp_style_expression_bodied_accessors = true:warning 12 | -------------------------------------------------------------------------------- /build/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using Nuke.Common.Tooling; 5 | 6 | [TypeConverter(typeof(TypeConverter))] 7 | public class Configuration : Enumeration 8 | { 9 | public static Configuration Debug = new Configuration { Value = nameof(Debug) }; 10 | public static Configuration Release = new Configuration { Value = nameof(Release) }; 11 | 12 | public static implicit operator string(Configuration configuration) 13 | { 14 | return configuration.Value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /build/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | postgresql: 4 | image: ${POSTGRES_IMAGE:-ionx/postgres-plv8:12.8} 5 | ports: 6 | - "5432:5432" 7 | environment: 8 | POSTGRES_PASSWORD: postgres 9 | POSTGRES_USER: postgres 10 | POSTGRES_DB: marten_testing 11 | NAMEDATALEN: 100 12 | -------------------------------------------------------------------------------- /docs/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | end_of_line = lf 6 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/custom.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --marten-brown-light: #b38c6c; 3 | --marten-brown-dark: #ac8464; 4 | --marten-brown: #ac8464; 5 | --marten-brown-soft: rgba(196, 164, 132, 0.14); 6 | 7 | --vp-c-brand-1: var(--marten-brown); 8 | --vp-c-brand-2: var(--marten-brown-dark); 9 | --vp-c-brand-3: var(--marten-brown-light); 10 | --vp-c-brand-soft: var(--marten-brown-soft); 11 | --vp-home-hero-name-color: var(--vp-c-brand-1); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/index.js: -------------------------------------------------------------------------------- 1 | import DefaultTheme from 'vitepress/theme' 2 | import './custom.css' 3 | import CustomLayout from './CustomLayout.vue' 4 | 5 | export default { 6 | extends: DefaultTheme, 7 | Layout: CustomLayout 8 | } 9 | -------------------------------------------------------------------------------- /docs/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnPaste": false, 3 | "editor.formatOnSave": true, 4 | "files.eol": "\n" 5 | } 6 | -------------------------------------------------------------------------------- /docs/community/tools-and-libraries.md: -------------------------------------------------------------------------------- 1 | # Tools and Libraries 2 | 3 | This page outlines all the tools and libraries built around Marten by the community. 4 | 5 | ## Sable 6 | 7 | [Sable](https://github.com/bloomberg/sable) is a database Migration Management Tool for Marten from Bloomberg Tech team (Joe Nathan Abellard et al.). 8 | 9 | GitHub Repository: [https://github.com/bloomberg/sable](https://github.com/bloomberg/sable) 10 | 11 | Documentation: [https://bloomberg.github.io/sable/](https://bloomberg.github.io/sable/) 12 | -------------------------------------------------------------------------------- /docs/images/StoreOptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/images/StoreOptions.png -------------------------------------------------------------------------------- /docs/images/marten.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/images/marten.jpeg -------------------------------------------------------------------------------- /docs/images/postgres-sequence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/images/postgres-sequence.png -------------------------------------------------------------------------------- /docs/images/postgres-table-definition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/images/postgres-table-definition.png -------------------------------------------------------------------------------- /docs/images/subscriptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/images/subscriptions.png -------------------------------------------------------------------------------- /docs/postgres/casing/case-insensitive-data.md: -------------------------------------------------------------------------------- 1 | # Case Insensitive Data (under construction) 2 | 3 | //TODO 4 | -------------------------------------------------------------------------------- /docs/postgres/casing/queries.md: -------------------------------------------------------------------------------- 1 | # Queries (under construction) 2 | 3 | //TODO 4 | -------------------------------------------------------------------------------- /docs/postgres/casing/unique-values.md: -------------------------------------------------------------------------------- 1 | # Unique Values (under construction) 2 | 3 | //TODO 4 | -------------------------------------------------------------------------------- /docs/postgres/casing/using-duplicate-fields.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/postgres/casing/using-duplicate-fields.md -------------------------------------------------------------------------------- /docs/postgres/casting.md: -------------------------------------------------------------------------------- 1 | # Casting (under construction) 2 | 3 | //TODO 4 | -------------------------------------------------------------------------------- /docs/postgres/dates.md: -------------------------------------------------------------------------------- 1 | # Working with Dates 2 | 3 | SQL Server has functions for modifying a date, such as `DATEADD(…)` 4 | 5 | Postgres has an interval type which allows you to add/remove in a much more semantic manner. 6 | 7 | For example, in SQL Server to add 5 days to the current date we might do: 8 | 9 | ```sql 10 | SELECT DATEADD(day, 5, getutcdate()) 11 | ``` 12 | 13 | In Postgres we would achieve the same like so: 14 | 15 | ```sql 16 | SELECT now() + ‘5 days’::interval; 17 | ``` 18 | -------------------------------------------------------------------------------- /docs/postgres/escaping.md: -------------------------------------------------------------------------------- 1 | # Escaping 2 | 3 | In SQL Server, escaping is done by wrapping with square brackets. 4 | 5 | select [Id] from [MyTable]; 6 | 7 | In Postgres this is done using double quotes. 8 | 9 | select "id" from "my_table"; 10 | -------------------------------------------------------------------------------- /docs/postgres/index.md: -------------------------------------------------------------------------------- 1 | # Postgres for SQL Server users 2 | 3 | PostgreSQL has some of the best documentation available, and it's pretty easy to lookup any most anything to do with Postgres, however coming from SQL Server can sometimes be a bit of a barrier to entry. 4 | 5 | This documentation exists to help the transition for some of the basic usage patterns between the two databases and how help you better understand PostgreSQL so you can get the best out of what Marten has to offer. 6 | -------------------------------------------------------------------------------- /docs/postgres/indexing-jsonb.md: -------------------------------------------------------------------------------- 1 | # Indexing JSONB (under construction) 2 | 3 | //TODO 4 | -------------------------------------------------------------------------------- /docs/postgres/indexing.md: -------------------------------------------------------------------------------- 1 | # Indexing (under construction) 2 | 3 | //TODO 4 | -------------------------------------------------------------------------------- /docs/postgres/slow-queries.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/postgres/slow-queries.md -------------------------------------------------------------------------------- /docs/public/_redirects: -------------------------------------------------------------------------------- 1 | /v3/* /v3/:splat 200! 2 | -------------------------------------------------------------------------------- /docs/public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /docs/public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /docs/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/public/dotnet-aws.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/dotnet-aws.png -------------------------------------------------------------------------------- /docs/public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/favicon-16x16.png -------------------------------------------------------------------------------- /docs/public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/favicon-32x32.png -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/logo.png -------------------------------------------------------------------------------- /docs/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Marten", 3 | "icons": [ 4 | { 5 | "src": "/android-chrome-192x192.png", 6 | "sizes": "192x192", 7 | "type": "image/png" 8 | }, 9 | { 10 | "src": "/android-chrome-512x512.png", 11 | "sizes": "512x512", 12 | "type": "image/png" 13 | } 14 | ], 15 | "theme_color": "#ffffff", 16 | "background_color": "#ffffff", 17 | "display": "standalone" 18 | } 19 | -------------------------------------------------------------------------------- /docs/public/social.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/docs/public/social.png -------------------------------------------------------------------------------- /docs/scenarios/index.md: -------------------------------------------------------------------------------- 1 | # Scenarios 2 | 3 | This page documents various use cases with a sample implementation using Marten. 4 | -------------------------------------------------------------------------------- /docs/vite.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | server: { 3 | fsServe: { 4 | root: '../' 5 | } 6 | }, 7 | optimizeDeps: { 8 | include: ['@braintree/sanitize-url'], 9 | }, 10 | resolve: { 11 | alias: { 12 | dayjs: 'dayjs/', 13 | }, 14 | }, 15 | build: { 16 | chunkSizeWarningLimit: 3000 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /documentation/content/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/documentation/content/images/banner.png -------------------------------------------------------------------------------- /documentation/content/images/emblem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/documentation/content/images/emblem.png -------------------------------------------------------------------------------- /documentation/content/images/marten.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/documentation/content/images/marten.jpeg -------------------------------------------------------------------------------- /documentation/content/images/postgres-sequence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/documentation/content/images/postgres-sequence.png -------------------------------------------------------------------------------- /documentation/content/images/postgres-table-definition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/documentation/content/images/postgres-table-definition.png -------------------------------------------------------------------------------- /documentation/content/sidebar.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | var sidebar = $('#sidebar'); 3 | 4 | $('#main-pane h2').each(function(i, h2){ 5 | var id = 'sec' + i.toString(); 6 | $(h2).attr('id', id); 7 | 8 | $('
  • ' + $(h2).html() + '
  • ').appendTo(sidebar); 9 | }); 10 | }); -------------------------------------------------------------------------------- /documentation/diagrams/index.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/documentation/diagrams/index.md -------------------------------------------------------------------------------- /documentation/documentation/admin/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A list of helpful information to manage your PostgreSQL instance. 5 | 6 | <[TableOfContents]> 7 | -------------------------------------------------------------------------------- /documentation/documentation/documents/advanced/cleaning.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | For the purpose of automated testing where you need to carefully control the state of the document storage, Marten supplies the 5 | `IDocumentCleaner` service to quickly remove persisted document state or even to completely tear down the entire document storage. 6 | 7 | This service is exposed as the `IDocumentStore.Advanced.Clean` property. You can see the usages of the document cleaner below: 8 | 9 | <[sample:clean_out_documents]> 10 | -------------------------------------------------------------------------------- /documentation/documentation/documents/advanced/eject.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | If for some reason you need to completely remove a document from a session's <[linkto:documentation/documents/advanced/identitymap;title=identity map]> and <[linkto:documentation/documents/basics/persisting;title=unit of work tracking]>, as of Marten 2.4.0 you can use the 4 | `IDocumentSession.Eject(T document)` syntax shown below in one of the tests: 5 | 6 | 7 | <[sample:ejecting_a_document]> -------------------------------------------------------------------------------- /documentation/documentation/documents/advanced/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | You've got the basics of document storage down, now it's time to dig into the more advanced features of Marten: 4 | 5 | <[TableOfContents]> -------------------------------------------------------------------------------- /documentation/documentation/documents/basics/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | These are the most common tasks that you'll perform on a daily basis with Marten: 4 | 5 | <[TableOfContents]> -------------------------------------------------------------------------------- /documentation/documentation/documents/basics/initial_data.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Marten supports seeding your database with initial data via the `IInitialData` interface. For example: 5 | 6 | <[sample:initial-data]> 7 | 8 | Add your `IInitialData` implementations as part of the configuration of your document store as follows: 9 | 10 | <[sample:configuring-initial-data]> 11 | 12 | `IInitialData.Populate(IDocumentStore store)` will be executed for each configured entry as part of the initialization of your document store. They will be executed in the order they were added. 13 | -------------------------------------------------------------------------------- /documentation/documentation/documents/basics/loading.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Documents can be loaded by id from the `IDocumentSession` interface, either one at a time or by an enumerable of id values. The load by id functionality 7 | again supports Guid's, integers, long integers, and strings. 8 | 9 | ## Synchronous Loading 10 | 11 | The syntax is shown below: 12 | 13 | <[sample:load_by_id]> 14 | 15 | 16 | ## Asynchronous Loading 17 | 18 | TODO(need a sample of async loading) 19 | -------------------------------------------------------------------------------- /documentation/documentation/documents/basics/order.txt: -------------------------------------------------------------------------------- 1 | persisting 2 | loading 3 | deleting 4 | bulk_insert 5 | initial_data -------------------------------------------------------------------------------- /documentation/documentation/documents/command-timeouts.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | By default, Marten just uses the underlying timeout configuration from the [Npgsql connection string](http://www.npgsql.org/doc/connection-string-parameters.html). 4 | You can though, opt to set a different command timeout per session with this syntax: 5 | 6 | <[sample:ConfigureCommandTimeout]> -------------------------------------------------------------------------------- /documentation/documentation/documents/configuration/gin_or_gist_index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | See [Exploring the Postgres Gin index](https://hashrocket.com/blog/posts/exploring-postgres-gin-index) for more information on the Gin index strategy within Postgresqsl. 4 | 5 | To optimize a wider range of adhoc queries against the document JSONB, you can apply a [Gin index](http://www.postgresql.org/docs/9.4/static/gin.html) to 6 | the JSON field in the database: 7 | 8 | <[sample:IndexExamples]> 9 | 10 | **Marten may be changed to make the Gin index on the data field be automatic in the future.** 11 | 12 | -------------------------------------------------------------------------------- /documentation/documentation/documents/order.txt: -------------------------------------------------------------------------------- 1 | identity 2 | basics 3 | querying 4 | tenancy 5 | configuration 6 | json 7 | advanced 8 | diagnostics 9 | command-timeouts -------------------------------------------------------------------------------- /documentation/documentation/documents/querying/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Marten provides a wide variety of support for querying documents: 4 | 5 | <[TableOfContents]> -------------------------------------------------------------------------------- /documentation/documentation/documents/querying/order.txt: -------------------------------------------------------------------------------- 1 | linq 2 | async 3 | sql 4 | projections 5 | query_json 6 | include 7 | compiled_queries 8 | batched_queries 9 | metadata_queries 10 | paging 11 | -------------------------------------------------------------------------------- /documentation/documentation/documents/tenancy/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Marten supports multi-tenancy to provide data isolation between tenants, aka groups of users. In effect, this allows scoping storage operations, such as persisting and loading data, so that no tenant can access data of others. Marten provides multi-tenancy at the logical level, by associating data records with a tenant identifier. In addition, multi-tenancy through separate databases or schemas is planned. 4 | 5 | By default, Marten operates in single-tenancy mode (`TenancyStyle.Single`) with multi-tenancy disabled. 6 | 7 | <[TableOfContents]> 8 | -------------------------------------------------------------------------------- /documentation/documentation/documents/tenancy/order.txt: -------------------------------------------------------------------------------- 1 | configuring 2 | basicoperations 3 | implementationdetails -------------------------------------------------------------------------------- /documentation/documentation/events/order.txt: -------------------------------------------------------------------------------- 1 | schema 2 | identity 3 | appending 4 | streams 5 | projections 6 | versioning 7 | -------------------------------------------------------------------------------- /documentation/documentation/events/projections/async_daemon.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | For most information, see Jeremy's blog post on [Offline Event Processing in Marten with the new “Async Daemon”](https://jeremydmiller.com/2016/08/04/offline-event-processing-in-marten-with-the-new-async-daemon/). 4 | -------------------------------------------------------------------------------- /documentation/documentation/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <[TableOfContents]> 5 | -------------------------------------------------------------------------------- /documentation/documentation/order.txt: -------------------------------------------------------------------------------- 1 | integration 2 | schema 3 | cli 4 | documents 5 | events 6 | precompiling 7 | troubleshoot 8 | scenarios 9 | admin 10 | postgres 11 | 12 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/backup-restore/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/backup-restore/local.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/backup-restore/remote.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/casing/case-insensitive-data.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/casing/order.txt: -------------------------------------------------------------------------------- 1 | unique-values 2 | case-insensitive-data 3 | queries 4 | using-duplicate-fields 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/casing/queries.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/casing/unique-values.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/casing/using-duplicate-fields.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/casting.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/dates.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SQL Server has functions for modifying a date, such as `DATEADD(…)` 5 | 6 | Postgres has an interval type which allows you to add/remove in a much more semantic manner. 7 | 8 | For example, in SQL Server to add 5 days to the current date we might do: 9 | 10 | SELECT DATEADD(day, 5, getutcdate()) 11 | 12 | In Postgres we would achieve the same like so: 13 | 14 | SELECT now() + ‘5 days’::interval; 15 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/escaping.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | In SQL Server, escaping is done by wrapping with square brackets. 5 | 6 | select [Id] from [MyTable]; 7 | 8 | In Postgres this is done using double quotes. 9 | 10 | select "id" from "my_table"; 11 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PostgreSQL has some of the best documentation available, and it's pretty easy to lookup any most anything to do with Postgres, however coming from SQL Server can sometimes be a bit of a barrier to entry. 5 | 6 | This documentation exists to help the transition for some of the basic usage patterns between the two databases and how help you better understand PostgreSQL so you can get the best out of what Marten has to offer. 7 | 8 | 9 | ## SQL Server to PostgreSQL Documentation 10 | 11 | <[TableOfContents]> 12 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/indexing.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/indexing_jsonb.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/order.txt: -------------------------------------------------------------------------------- 1 | naming 2 | escaping 3 | types 4 | casting 5 | casing 6 | slow_queries 7 | indexing 8 | indexing_jsonb 9 | if_statements 10 | dates 11 | backup-restore 12 | -------------------------------------------------------------------------------- /documentation/documentation/postgres/slow_queries.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | //TODO 5 | -------------------------------------------------------------------------------- /documentation/documentation/scenarios/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This page documents various use cases with a sample implementation using Marten. 5 | 6 | ## Scenarios 7 | 8 | <[TableOfContents]> -------------------------------------------------------------------------------- /documentation/documentation/schema/order.txt: -------------------------------------------------------------------------------- 1 | storage 2 | metadata 3 | schema 4 | migrations 5 | exporting 6 | -------------------------------------------------------------------------------- /documentation/documentation/schema/schema.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | By default, Marten will put all database schema objects into the main _public_ schema. If you want to override this behavior, 4 | use the `StoreOptions.DocumentSchemaName` property when configuring your `IDocumentStore`: 5 | 6 | <[sample:override_schema_per_table]> 7 | 8 | As you can see, you can also choose to configure the schema storage for each document type individually. -------------------------------------------------------------------------------- /documentation/order.txt: -------------------------------------------------------------------------------- 1 | getting_started 2 | documentation 3 | -------------------------------------------------------------------------------- /mdsnippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "Convention": "InPlaceOverwrite", 3 | "LinkFormat": "GitHub", 4 | "UrlPrefix": "https://github.com/JasperFx/marten/blob/master", 5 | "ExcludeMarkdownDirectories": ["documentation", "planning", "./src/DinnerParty"], 6 | "ExcludeSnippetDirectories": ["./src/Marten", "./src/CommandLineRunner", "./src/DinnerParty", "./src/EventPublisher", "./src/EventSourceWorker", "./src/Marten", "./src/Marten.CommandLine", "./src/Marten.NodaTime", "./src/Marten.PLv8", "Marten.Storyteller", "./src/MartenBenchmarks", "./src/StorytellerRunner"], 7 | "TreatMissingAsWarning": false 8 | } 9 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | publish = "docs/.vitepress/dist/" 3 | 4 | [[redirects]] 5 | from = "/v3/" 6 | to = "/v3/index.html" 7 | status = 200 8 | force = true 9 | 10 | [[redirects]] 11 | from = "/discord" 12 | to = "https://discord.gg/WMxrvegf8H" 13 | status = 301 14 | force = false -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "mdsnippets": "mdsnippets", 5 | "vitepress-dev": "vitepress dev docs --port 5050 --open", 6 | "vitepress-build": "vitepress build docs", 7 | "docs": "concurrently --group mdsnippets \"vitepress dev docs --port 5050 --open\"", 8 | "docs-build": "concurrently --group mdsnippets \"vitepress build docs\"", 9 | "deploy-preview": "netlify deploy", 10 | "deploy": "netlify deploy --prod" 11 | }, 12 | "devDependencies": { 13 | "concurrently": "^9.1.2", 14 | "netlify-cli": "^21.5.0", 15 | "vitepress": "1.6.3", 16 | "vitepress-plugin-mermaid": "^2.0.17" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AspNetCoreWithMarten/AspNetCoreWithMarten.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/AspNetCoreWithMarten/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "AspNetCoreWithMarten": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 7 | "environmentVariables": { 8 | "ASPNETCORE_ENVIRONMENT": "Development" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/AspNetCoreWithMarten/User.cs: -------------------------------------------------------------------------------- 1 | namespace AspNetCoreWithMarten; 2 | 3 | #region sample_GettingStartedUser 4 | public class User 5 | { 6 | public Guid Id { get; set; } 7 | public required string FirstName { get; set; } 8 | public required string LastName { get; set; } 9 | 10 | public bool Internal { get; set; } 11 | } 12 | #endregion 13 | -------------------------------------------------------------------------------- /src/AspNetCoreWithMarten/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/AspNetCoreWithMarten/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "ConnectionStrings": { 11 | "Marten": "Host=localhost;Port=5432;Database=postgres;Username=postgres;password=postgres" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AspNetODataWithMarten/Controllers/WeatherForecastController.cs: -------------------------------------------------------------------------------- 1 | using Marten; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.AspNetCore.OData.Query; 4 | using Microsoft.AspNetCore.OData.Routing.Controllers; 5 | 6 | namespace AspNetODataWithMarten.Controllers; 7 | 8 | [Route("/weatherforecast")] 9 | public class WeatherForecastController : ODataController 10 | { 11 | [HttpGet] 12 | [EnableQuery] 13 | public IActionResult Get([FromServices] IDocumentSession session ) 14 | { 15 | return Ok(session.Query()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/AspNetODataWithMarten/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "AspNetODataWithMarten": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "https://localhost:50727;http://localhost:50728" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/CommandLineRunner/CommandLineRunner.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | dotnet-CommandLineRunner-144A5847-CAC2-4DF8-A6D4-C4150BB90A23 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/CommandLineRunner/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "CommandLineRunner": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": "true", 6 | "environmentVariables": { 7 | "DOTNET_ENVIRONMENT": "Development" 8 | }, 9 | "commandLineArgs": "test" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/CommandLineRunner/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/CommandLineRunner/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ContainerScopedProjectionTests/LetterCounts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ContainerScopedProjectionTests; 4 | 5 | public class LetterCounts 6 | { 7 | public LetterCounts() 8 | { 9 | } 10 | 11 | public Guid Id { get; set; } 12 | public int ACount { get; set; } 13 | public int BCount { get; set; } 14 | public int CCount { get; set; } 15 | public int DCount { get; set; } 16 | public double Price { get; set; } 17 | } -------------------------------------------------------------------------------- /src/CoreTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/CoreTests/Bugs/Bug_2564_database_creation.cs: -------------------------------------------------------------------------------- 1 | using Marten.Testing.Harness; 2 | 3 | namespace CoreTests.Bugs; 4 | 5 | public class Bug_2564_database_creation : BugIntegrationContext 6 | { 7 | 8 | } 9 | 10 | public sealed class Dbo 11 | { 12 | public string Id { get; } 13 | 14 | 15 | public Dbo(string id) 16 | { 17 | Id = id; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/CoreTests/Diagnostics/ability_to_fetch_postgres_server_version.cs: -------------------------------------------------------------------------------- 1 | using Marten.Testing.Harness; 2 | using Shouldly; 3 | using Xunit; 4 | 5 | namespace CoreTests.Diagnostics; 6 | 7 | public class ability_to_fetch_postgres_server_version: IntegrationContext 8 | { 9 | [Fact] 10 | public void can_fetch_postgres_server_version() 11 | { 12 | #region sample_get_postgres_version 13 | var pgVersion = theStore.Diagnostics.GetPostgresVersion(); 14 | #endregion 15 | pgVersion.ShouldNotBeNull(); 16 | } 17 | 18 | public ability_to_fetch_postgres_server_version(DefaultStoreFixture fixture) : base(fixture) 19 | { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/CoreTests/Exceptions/MartenCommandExceptionTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Marten.Exceptions; 3 | using Shouldly; 4 | using Xunit; 5 | 6 | namespace CoreTests.Exceptions; 7 | 8 | public class MartenCommandExceptionTests 9 | { 10 | [Fact] 11 | public void should_create_MartenCommandException_when_command_is_null() 12 | { 13 | var createWithNullCommand = () => new MartenCommandException(null, new Exception()); 14 | 15 | createWithNullCommand.ShouldNotThrow(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/CoreTests/enhance_polly_smoke_test.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Marten.Testing.Documents; 3 | using Marten.Testing.Harness; 4 | using Marten.Util; 5 | using Xunit; 6 | 7 | namespace CoreTests; 8 | 9 | public class enhance_polly_smoke_test : OneOffConfigurationsContext 10 | { 11 | [Fact] 12 | public async Task smoke_test() 13 | { 14 | StoreOptions(opts => 15 | { 16 | opts.ExtendPolly(builder => 17 | { 18 | builder.AddMartenDefaults(); 19 | }); 20 | }); 21 | 22 | theSession.Store(Target.Random()); 23 | await theSession.SaveChangesAsync(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/DaemonTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] 3 | -------------------------------------------------------------------------------- /src/DaemonTests/FlatTableProjections/ValuesAdded.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.FlatTableProjections; 2 | 3 | public class ValuesAdded 4 | { 5 | public int A { get; set; } 6 | public int B { get; set; } 7 | public int C { get; set; } 8 | public int D { get; set; } 9 | public string Name { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/DaemonTests/FlatTableProjections/ValuesDeleted.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.FlatTableProjections; 2 | 3 | public class ValuesDeleted 4 | { 5 | public string Name { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/DaemonTests/FlatTableProjections/ValuesSet.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.FlatTableProjections; 2 | 3 | public class ValuesSet 4 | { 5 | public int A { get; set; } 6 | public int B { get; set; } 7 | public int C { get; set; } 8 | public int D { get; set; } 9 | 10 | public string Name { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /src/DaemonTests/FlatTableProjections/ValuesSubtracted.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.FlatTableProjections; 2 | 3 | public class ValuesSubtracted 4 | { 5 | public int A { get; set; } 6 | public int B { get; set; } 7 | public int C { get; set; } 8 | public int D { get; set; } 9 | public string Name { get; set; } 10 | 11 | public int? NullableNumber { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/DaemonTests/TestSetup.cs: -------------------------------------------------------------------------------- 1 | using Marten.Services.Json; 2 | using Marten.Testing.Harness; 3 | using Xunit; 4 | using Xunit.Abstractions; 5 | using Xunit.Sdk; 6 | 7 | [assembly: TestFramework("Marten.AsyncDaemon.TestSetup", "Marten.AsyncDaemon")] 8 | 9 | namespace Marten.AsyncDaemon.Testing; 10 | 11 | public class TestSetup : XunitTestFramework 12 | { 13 | public TestSetup(IMessageSink messageSink) 14 | :base(messageSink) 15 | { 16 | SerializerFactory.DefaultSerializerType = TestsSettings.SerializerType; 17 | } 18 | } -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/Arrival.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.TestingSupport; 2 | 3 | public class Arrival 4 | { 5 | public int Day { get; set; } 6 | public string State { get; set; } 7 | } -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/Departure.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.TestingSupport; 2 | 3 | public class Departure 4 | { 5 | public int Day { get; set; } 6 | public string State { get; set; } 7 | } -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/Direction.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.TestingSupport; 2 | 3 | public enum Direction 4 | { 5 | North, 6 | South, 7 | East, 8 | West 9 | } -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/IDayEvent.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.TestingSupport; 2 | 3 | public interface IDayEvent 4 | { 5 | int Day { get; } 6 | } -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/Stop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DaemonTests.TestingSupport; 4 | 5 | public class Stop 6 | { 7 | public TimeOnly Time { get; set; } 8 | public string State { get; set; } 9 | public int Duration { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/TripAborted.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.TestingSupport; 2 | 3 | public class TripAborted 4 | { 5 | 6 | } 7 | 8 | public class Breakdown 9 | { 10 | public bool IsCritical { get; set; } 11 | } 12 | 13 | public class VacationOver 14 | { 15 | 16 | } -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/TripEnded.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.TestingSupport; 2 | 3 | public class TripEnded : IDayEvent 4 | { 5 | public int Day { get; set; } 6 | public string State { get; set; } 7 | } -------------------------------------------------------------------------------- /src/DaemonTests/TestingSupport/TripStarted.cs: -------------------------------------------------------------------------------- 1 | namespace DaemonTests.TestingSupport; 2 | 3 | public class TripStarted : IDayEvent 4 | { 5 | public int Day { get; set; } 6 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/DocumentDbTests/Bugs/Bug_416_cannot_create_index_on_datetime_field.cs: -------------------------------------------------------------------------------- 1 | using Marten.Testing.Documents; 2 | using Marten.Testing.Harness; 3 | using Xunit; 4 | 5 | namespace DocumentDbTests.Bugs; 6 | 7 | public class Bug_416_cannot_create_index_on_datetime_field: BugIntegrationContext 8 | { 9 | [Fact] 10 | public void should_throw_a_defensive_check_telling_you_that_you_cannot_index_a_date_time_field() 11 | { 12 | StoreOptions(_ => _.Schema.For().Index(x => x.Date)); 13 | 14 | theStore.Tenancy.Default.Database.EnsureStorageExists(typeof(Target)); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/DocumentDbTests/HierarchicalStorage/BasePolicy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace DocumentDbTests.HierarchicalStorage; 5 | 6 | public abstract class BasePolicy: IPolicy 7 | { 8 | public Guid VersionId { get; set; } = Guid.NewGuid(); 9 | public Guid DocumentId { get; set; } = Guid.NewGuid(); 10 | 11 | [JsonIgnore] public abstract PolicyType Type { get; protected set; } 12 | 13 | public string Name { get; set; } 14 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/HierarchicalStorage/IPolicy.cs: -------------------------------------------------------------------------------- 1 | namespace DocumentDbTests.HierarchicalStorage; 2 | 3 | public interface IPolicy: IVersioned 4 | { 5 | PolicyType Type { get; } 6 | string Name { get; set; } 7 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/HierarchicalStorage/IVersioned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace DocumentDbTests.HierarchicalStorage; 4 | 5 | public interface IVersioned 6 | { 7 | /// The unique ID of a version of the document 8 | Guid VersionId { get; set; } 9 | 10 | /// ID that remains the same for all versions of a document 11 | Guid DocumentId { get; set; } 12 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/HierarchicalStorage/LinuxPolicy.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace DocumentDbTests.HierarchicalStorage; 4 | 5 | public class LinuxPolicy: OsPolicy 6 | { 7 | [JsonIgnore] public override PolicyType Type { get; protected set; } = PolicyType.Linux; 8 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/HierarchicalStorage/OsPolicy.cs: -------------------------------------------------------------------------------- 1 | namespace DocumentDbTests.HierarchicalStorage; 2 | 3 | public abstract class OsPolicy: BasePolicy 4 | { 5 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/HierarchicalStorage/PolicyType.cs: -------------------------------------------------------------------------------- 1 | namespace DocumentDbTests.HierarchicalStorage; 2 | 3 | public enum PolicyType 4 | { 5 | Windows = 1, 6 | Linux = 2 7 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/HierarchicalStorage/WindowsPolicy.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace DocumentDbTests.HierarchicalStorage; 4 | 5 | public class WindowsPolicy: OsPolicy 6 | { 7 | [JsonIgnore] public override PolicyType Type { get; protected set; } = PolicyType.Windows; 8 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/MultiTenancy/MultiTenancyFixture.cs: -------------------------------------------------------------------------------- 1 | using Marten.Testing.Documents; 2 | using Marten.Testing.Harness; 3 | 4 | namespace DocumentDbTests.MultiTenancy; 5 | 6 | public class MultiTenancyFixture: StoreFixture 7 | { 8 | public MultiTenancyFixture(): base("multi_tenancy") 9 | { 10 | Options.Policies.AllDocumentsAreMultiTenanted(); 11 | Options.Schema.For().UseOptimisticConcurrency(true); 12 | } 13 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/Reading/UserName.cs: -------------------------------------------------------------------------------- 1 | namespace DocumentDbTests.Reading; 2 | 3 | public class UserName 4 | { 5 | public string Name { get; set; } 6 | } -------------------------------------------------------------------------------- /src/DocumentDbTests/TestSetup.cs: -------------------------------------------------------------------------------- 1 | using Marten.Services.Json; 2 | using Marten.Testing.Harness; 3 | using Xunit; 4 | using Xunit.Abstractions; 5 | using Xunit.Sdk; 6 | 7 | [assembly: TestFramework("DocumentDbTests.TestSetup", "DocumentDbTests")] 8 | 9 | namespace DocumentDbTests; 10 | 11 | public class TestSetup : XunitTestFramework 12 | { 13 | public TestSetup(IMessageSink messageSink) 14 | :base(messageSink) 15 | { 16 | SerializerFactory.DefaultSerializerType = TestsSettings.SerializerType; 17 | } 18 | } -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/EventAppenderPerfTester.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/ITestPlan.cs: -------------------------------------------------------------------------------- 1 | using Marten; 2 | 3 | namespace EventAppenderPerfTester; 4 | 5 | public interface ITestPlan 6 | { 7 | Task Execute(IDocumentSession session); 8 | void FetchData(); 9 | } -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/MultiplesTestPlan.cs: -------------------------------------------------------------------------------- 1 | using DaemonTests.TestingSupport; 2 | using Marten; 3 | 4 | namespace EventAppenderPerfTester; 5 | 6 | public class MultiplesTestPlan: ITestPlan 7 | { 8 | private List _data; 9 | 10 | public async Task Execute(IDocumentSession session) 11 | { 12 | foreach (var trips in _data) 13 | { 14 | await TripStream.PublishMultiplesSimple(session, trips); 15 | } 16 | } 17 | 18 | public void FetchData() 19 | { 20 | _data = TripStreamReaderWriter.ReadPages(100, 10); 21 | } 22 | } -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/ReadCommand.cs: -------------------------------------------------------------------------------- 1 | using JasperFx; 2 | using JasperFx.CommandLine; 3 | 4 | namespace EventAppenderPerfTester; 5 | 6 | public class ReadCommand : JasperFxAsyncCommand 7 | { 8 | public override async Task Execute(NetCoreInput input) 9 | { 10 | using var host = input.BuildHost(); 11 | var trips = TripStreamReaderWriter.Read(); 12 | 13 | Console.WriteLine("Read trips"); 14 | 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/SingleFileFetchForWritingPlan.cs: -------------------------------------------------------------------------------- 1 | using DaemonTests.TestingSupport; 2 | using Marten; 3 | 4 | namespace EventAppenderPerfTester; 5 | 6 | public class SingleFileFetchForWritingPlan: ITestPlan 7 | { 8 | private List _data; 9 | 10 | public async Task Execute(IDocumentSession session) 11 | { 12 | foreach (var tripStream in _data) 13 | { 14 | await tripStream.PublishSingleFileWithFetchForWriting(session); 15 | } 16 | } 17 | 18 | public void FetchData() 19 | { 20 | _data = TripStreamReaderWriter.ReadPages(1); 21 | } 22 | } -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/SingleFileSimplePlan.cs: -------------------------------------------------------------------------------- 1 | using DaemonTests.TestingSupport; 2 | using Marten; 3 | 4 | namespace EventAppenderPerfTester; 5 | 6 | public class SingleFileSimplePlan: ITestPlan 7 | { 8 | private List _data; 9 | 10 | public async Task Execute(IDocumentSession session) 11 | { 12 | foreach (var tripStream in _data) 13 | { 14 | await tripStream.PublishSingleFileSimple(session); 15 | } 16 | } 17 | 18 | public void FetchData() 19 | { 20 | _data = TripStreamReaderWriter.ReadPages(1); 21 | } 22 | } -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/TestInput.cs: -------------------------------------------------------------------------------- 1 | using JasperFx; 2 | using JasperFx.CommandLine; 3 | 4 | namespace EventAppenderPerfTester; 5 | 6 | public class TestInput: NetCoreInput 7 | { 8 | public TestType TypeFlag { get; set; } = TestType.All; 9 | } 10 | -------------------------------------------------------------------------------- /src/EventAppenderPerfTester/TestType.cs: -------------------------------------------------------------------------------- 1 | namespace EventAppenderPerfTester; 2 | 3 | public enum TestType 4 | { 5 | SingleFileSimple, 6 | SingleFileFetchForWriting, 7 | Multiples, 8 | All 9 | } -------------------------------------------------------------------------------- /src/EventSourceWorker/EventSourceWorker.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | dotnet-EventSourceWorker-01BE20B5-3C2D-434B-8822-823B56E3F401 5 | enable 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/EventSourceWorker/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "EventSourceWorker": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": "true", 6 | "environmentVariables": { 7 | "DOTNET_ENVIRONMENT": "Development" 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/EventSourceWorker/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/EventSourceWorker/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/EventSourcingTests/Aggregation/OrderAggregate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using EventSourcingTests.Examples; 3 | 4 | namespace EventSourcingTests.Aggregation; 5 | 6 | #region sample_OrderAggregate_with_version 7 | 8 | public class OrderAggregate 9 | { 10 | // This is most likely the stream id 11 | public Guid Id { get; set; } 12 | 13 | // This would be set automatically by Marten if 14 | // used as the target of a SingleStreamAggregation 15 | public int Version { get; set; } 16 | 17 | public void Apply(OrderShipped shipped) => HasShipped = true; 18 | public bool HasShipped { get; private set; } 19 | } 20 | 21 | #endregion 22 | -------------------------------------------------------------------------------- /src/EventSourcingTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/EventSourcingTests/EventMappingTests.cs: -------------------------------------------------------------------------------- 1 | using Marten; 2 | using Marten.Events; 3 | using Shouldly; 4 | using Xunit; 5 | 6 | namespace EventSourcingTests; 7 | 8 | public class EventMappingTests 9 | { 10 | [Fact] 11 | public void event_name_for_event_type() 12 | { 13 | var options = new StoreOptions(); 14 | var mapping = new EventMapping(new EventGraph(options)); 15 | 16 | mapping.EventTypeName.ShouldBe("members_joined"); 17 | } 18 | } -------------------------------------------------------------------------------- /src/EventSourcingTests/FakeAggregate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EventSourcingTests; 4 | 5 | public class FakeAggregate 6 | { 7 | public Guid Id { get; set; } 8 | 9 | public string[] ANames; 10 | public string[] BNames; 11 | public string[] CNames; 12 | public string[] DNames; 13 | } 14 | 15 | public class EventA 16 | { 17 | public string Name { get; set; } 18 | } 19 | 20 | public class EventB 21 | { 22 | public string Name { get; set; } 23 | } 24 | 25 | public class EventC 26 | { 27 | public string Name { get; set; } 28 | } 29 | 30 | public class EventD 31 | { 32 | public Guid Id { get; set; } 33 | 34 | public string Name { get; set; } 35 | } -------------------------------------------------------------------------------- /src/EventSourcingTests/Projections/Flattened/ValuesAdded.cs: -------------------------------------------------------------------------------- 1 | namespace EventSourcingTests.Projections.Flattened; 2 | 3 | public class ValuesAdded 4 | { 5 | public int A { get; set; } 6 | public int B { get; set; } 7 | public int C { get; set; } 8 | public int D { get; set; } 9 | public string Name { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/EventSourcingTests/Projections/Flattened/ValuesDeleted.cs: -------------------------------------------------------------------------------- 1 | namespace EventSourcingTests.Projections.Flattened; 2 | 3 | public class ValuesDeleted 4 | { 5 | public string Name { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/EventSourcingTests/Projections/Flattened/ValuesSet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace EventSourcingTests.Projections.Flattened; 4 | 5 | public class ValuesSet 6 | { 7 | public int A { get; set; } 8 | public int B { get; set; } 9 | public int C { get; set; } 10 | public int D { get; set; } 11 | 12 | public string Name { get; set; } 13 | public Guid Guid { get; set; } = Guid.NewGuid(); 14 | public DateTimeOffset Time { get; set; } = DateTimeOffset.UtcNow; 15 | } 16 | -------------------------------------------------------------------------------- /src/EventSourcingTests/Projections/Flattened/ValuesSubtracted.cs: -------------------------------------------------------------------------------- 1 | namespace EventSourcingTests.Projections.Flattened; 2 | 3 | public class ValuesSubtracted 4 | { 5 | public int A { get; set; } 6 | public int B { get; set; } 7 | public int C { get; set; } 8 | public int D { get; set; } 9 | public string Name { get; set; } 10 | 11 | public int? MaybeNumber { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /src/EventSourcingTests/QuickAppend/StringIdentifiedStreamsCollection.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace EventSourcingTests.QuickAppend; 4 | 5 | [CollectionDefinition("quick_string_identified_streams")] 6 | public class StringIdentifiedStreamsCollection: ICollectionFixture 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /src/EventStoreMigrations/EventStoreMigrations.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | ConnectionSource.cs 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/FSharpTypes/FSharpTypes.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 8.0 6 | net8.0;net9.0 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/IssueService/Controllers/JsonController.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Marten; 3 | using Marten.AspNetCore; 4 | using Microsoft.AspNetCore.Mvc; 5 | 6 | namespace IssueService.Controllers 7 | { 8 | public class JsonController : ControllerBase 9 | { 10 | [HttpGet("/json/sql/{value1}/{value2}")] 11 | public Task GetJsonFromSql([FromServices] IQuerySession store, string value1, string value2) 12 | => store.WriteJson("SELECT jsonb_build_object('Property', ?) UNION SELECT jsonb_build_object('Property', ?);", HttpContext, contentType: "application/json", onFoundStatus: 200, parameters: new object[]{value1, value2}); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/IssueService/IssueService.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ConnectionSource.cs 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/IssueService/MartenSettings.cs: -------------------------------------------------------------------------------- 1 | namespace IssueService; 2 | 3 | #region sample_integration_settings 4 | public class MartenSettings 5 | { 6 | public const string SECTION = "Marten"; 7 | public string SchemaName { get; set; } 8 | } 9 | #endregion 10 | -------------------------------------------------------------------------------- /src/IssueService/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/IssueService/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /src/LinqTests/Acceptance/Support/LinqTestCase.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Marten; 3 | using Marten.Testing.Documents; 4 | using Marten.Testing.Harness; 5 | 6 | namespace LinqTests.Acceptance.Support; 7 | 8 | public abstract class LinqTestCase 9 | { 10 | public string Description { get; set; } 11 | 12 | public abstract Task Compare(IQuerySession session, Target[] documents, 13 | TestOutputMartenLogger logger); 14 | 15 | public bool Ordered { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /src/LinqTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/LinqTests/Bugs/Bug_3117_select_directly_to_DateTime.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Marten; 3 | using Marten.Testing.Documents; 4 | using Marten.Testing.Harness; 5 | 6 | namespace LinqTests.Bugs; 7 | 8 | public class Bug_3117_select_directly_to_DateTime : BugIntegrationContext 9 | { 10 | [Fact] 11 | public async Task select_max_date_time() 12 | { 13 | await theStore.BulkInsertDocumentsAsync(Target.GenerateRandomData(100)); 14 | 15 | var time = await theSession.Query().MaxAsync(x => x.Date); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/LinqTests/Internals/ComparisonBetweenFieldsFragmentTests.cs: -------------------------------------------------------------------------------- 1 | using Shouldly; 2 | using Weasel.Postgresql.SqlGeneration; 3 | 4 | namespace LinqTests.Internals; 5 | 6 | public class ComparisonBetweenFieldsFragmentTests 7 | { 8 | [Fact] 9 | public void reverse() 10 | { 11 | var where = new ComparisonFilter(null, null, "!="); 12 | var reversed = where.Reverse(); 13 | 14 | // I know, FP guys are going to go nuts, but it's 15 | // not shared over threads and this is less allocations 16 | // than a full clone 17 | reversed.ShouldBeSameAs(where); 18 | 19 | where.Op.ShouldBe("="); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/LinqTests/Internals/ComparisonFilterTests.cs: -------------------------------------------------------------------------------- 1 | using Shouldly; 2 | using Weasel.Postgresql.SqlGeneration; 3 | 4 | namespace LinqTests.Internals; 5 | 6 | public class ComparisonFilterTests 7 | { 8 | [Fact] 9 | public void reverse() 10 | { 11 | var where = new ComparisonFilter(null, null, "="); 12 | var reversed = where.Reverse(); 13 | 14 | // I know, FP guys are going to go nuts, but it's 15 | // not shared over threads and this is less allocations 16 | // than a full clone 17 | reversed.ShouldBeSameAs(where); 18 | 19 | where.Op.ShouldBe("!="); 20 | } 21 | } -------------------------------------------------------------------------------- /src/LinqTests/Internals/ExpressionExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq.Expressions; 2 | using Marten.Linq.Parsing; 3 | using Shouldly; 4 | 5 | namespace LinqTests.Internals; 6 | 7 | public class ExpressionExtensionsTests 8 | { 9 | [Fact] 10 | public void value_of_constant() 11 | { 12 | var constant = Expression.Constant("foo"); 13 | 14 | constant.Value() 15 | .ShouldBe("foo"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/LinqTests/TestSetup.cs: -------------------------------------------------------------------------------- 1 | using Marten.Services.Json; 2 | using Marten.Testing.Harness; 3 | using Xunit.Abstractions; 4 | using Xunit.Sdk; 5 | 6 | [assembly: TestFramework("LinqTests.TestSetup", "LinqTests")] 7 | 8 | namespace LinqTests; 9 | 10 | public class TestSetup : XunitTestFramework 11 | { 12 | public TestSetup(IMessageSink messageSink) 13 | :base(messageSink) 14 | { 15 | SerializerFactory.DefaultSerializerType = TestsSettings.SerializerType; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/LinqTests/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Xunit; 2 | -------------------------------------------------------------------------------- /src/LinqTestsTypes/LinqTestsTypes.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0;net9.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | Target.cs 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Marten.AspNetCore.Testing/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/Marten.AspNetCore.Testing/IntegrationCollection.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Marten.AspNetCore.Testing; 4 | 5 | #region sample_integration_collection 6 | [CollectionDefinition("integration")] 7 | public class IntegrationCollection : ICollectionFixture 8 | { 9 | } 10 | #endregion 11 | -------------------------------------------------------------------------------- /src/Marten.AspNetCore/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Marten.Testing")] 4 | [assembly: InternalsVisibleTo("Marten.CommandLine")] 5 | [assembly: InternalsVisibleTo("Marten.PLv8")] 6 | [assembly: InternalsVisibleTo("Marten.PLv8.Testing")] 7 | [assembly: InternalsVisibleTo("Marten.Schema.Testing")] 8 | [assembly: InternalsVisibleTo("DaemonTests")] 9 | [assembly: InternalsVisibleTo("ConfigurationTests")] 10 | [assembly: InternalsVisibleTo("CoreTests")] 11 | [assembly: InternalsVisibleTo("DocumentDbTests")] 12 | [assembly: InternalsVisibleTo("EventSourcingTests")] 13 | [assembly: InternalsVisibleTo("Examples")] 14 | -------------------------------------------------------------------------------- /src/Marten.CommandLine.Tests/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Xunit; 2 | -------------------------------------------------------------------------------- /src/Marten.NodaTime.Testing/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/Marten.Testing.OtherAssembly/Bug1851/StoredObjectInOtherAssembly.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.OtherAssembly.Bug1851; 4 | 5 | public class StoredObjectInOtherAssembly 6 | { 7 | public Guid Id { get; set; } 8 | public string Name { get; set; } = string.Empty; 9 | } -------------------------------------------------------------------------------- /src/Marten.Testing.OtherAssembly/Bug1984/GenericEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.OtherAssembly.Bug1984; 4 | 5 | public class GenericEntity 6 | { 7 | public Guid Id { get; set; } 8 | public T Data { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Marten.Testing.OtherAssembly/DeeperNamespace/BaseDocumentWithId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.OtherAssembly.DeeperNamespace; 4 | 5 | public abstract class BaseDocumentWithId 6 | { 7 | public BaseDocumentWithId() 8 | { 9 | Id = Guid.NewGuid(); 10 | } 11 | 12 | public Guid Id { get; set; } 13 | } -------------------------------------------------------------------------------- /src/Marten.Testing.ThirdAssembly/Bug1984/Data.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Testing.ThirdAssembly.Bug1984; 2 | 3 | public class Data 4 | { 5 | public string SomeField { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Marten.Testing/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Marten.Testing/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/Marten.Testing/CodeTracker/IssueState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.CodeTracker; 4 | 5 | public class IssueState 6 | { 7 | public Guid ProjectId { get; set; } 8 | public int Number { get; set; } 9 | public string Id { get; set; } 10 | 11 | public bool IsOpen { get; set; } 12 | 13 | public UserAction Created { get; set; } 14 | public UserAction Closed { get; set; } 15 | 16 | public IssueState() 17 | { 18 | } 19 | 20 | public IssueState(Guid projectId, int number) 21 | { 22 | ProjectId = projectId; 23 | Number = number; 24 | } 25 | } -------------------------------------------------------------------------------- /src/Marten.Testing/CodeTracker/UserAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.CodeTracker; 4 | 5 | public class UserAction 6 | { 7 | public UserAction() 8 | { 9 | } 10 | 11 | public UserAction(string userName, DateTimeOffset timestamp) 12 | { 13 | UserName = userName; 14 | Timestamp = timestamp; 15 | } 16 | 17 | public string UserName { get; set; } 18 | public DateTimeOffset Timestamp { get; set; } 19 | } -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/Account.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Testing.Documents; 2 | 3 | public class Account 4 | { 5 | public string Id { get;set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/Company.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.Documents; 4 | 5 | public class Company 6 | { 7 | public Company() 8 | { 9 | 10 | } 11 | 12 | public Guid Id { get; set; } 13 | 14 | public string Name { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/CriticalIssue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.Documents; 4 | 5 | public class CriticalIssue: Issue 6 | { 7 | public DateTime BecameCritical { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/GuidDoc.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.Documents; 4 | 5 | public class GuidDoc 6 | { 7 | public Guid Id { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/IntDoc.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Testing.Documents; 2 | 3 | public class IntDoc 4 | { 5 | public int Id { get; set; } 6 | 7 | public IntDoc() 8 | { 9 | } 10 | 11 | public IntDoc(int id) 12 | { 13 | Id = id; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/InvalidDocument.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Testing.Documents; 2 | 3 | // this document does not have an identity field 4 | public class InvalidDocument 5 | { 6 | public string Name { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/LongDoc.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Testing.Documents; 2 | 3 | public class LongDoc 4 | { 5 | public long Id { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/SingleTenantedDocument.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Marten.Schema; 3 | 4 | namespace Marten.Testing.Documents; 5 | 6 | [SingleTenanted] 7 | public class SingleTenantedDocument 8 | { 9 | public Guid Id { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/StringDoc.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace Marten.Testing.Documents; 4 | 5 | public class StringDoc 6 | { 7 | [JsonInclude] // this is needed to make System.Text.Json happy 8 | public string Id; 9 | public string Size { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten.Testing/Documents/UserWithInheritedId.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Testing.Documents; 2 | 3 | public class UserFromBaseDocument: OtherAssembly.DeeperNamespace.BaseDocumentWithId 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/Marten.Testing/Examples/IdExamples.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.Examples; 4 | 5 | #region sample_id_samples 6 | public class Division 7 | { 8 | // String property as Id 9 | public string Id { get; set; } 10 | } 11 | 12 | public class Category 13 | { 14 | // Guid's work, fields too 15 | public Guid Id; 16 | } 17 | 18 | public class Invoice 19 | { 20 | // int's and long's can be the Id 21 | // "id" is accepted 22 | public int id { get; set; } 23 | } 24 | 25 | #endregion -------------------------------------------------------------------------------- /src/Marten.Testing/Github/bottles.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JasperFx/marten/65d81460eda0ed9e91348c0b0ff6c0f852eee748/src/Marten.Testing/Github/bottles.json -------------------------------------------------------------------------------- /src/Marten.Testing/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // As XUnity cannot easily handle cancellation token passing 2 | // without additional boilerplate then let's disable this rule 3 | 4 | [assembly: 5 | System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", 6 | "MA0032:Use an overload with a CancellationToken argument")] 7 | -------------------------------------------------------------------------------- /src/Marten.Testing/Harness/BugIntegrationContext.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Marten.Testing.Harness 4 | { 5 | /// 6 | /// Please use this context for testing defects that require a special DocumentStore setup 7 | /// 8 | public class BugIntegrationContext: OneOffConfigurationsContext 9 | { 10 | public BugIntegrationContext() 11 | { 12 | _schemaName = "bugs"; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten.Testing/TestSetup.cs: -------------------------------------------------------------------------------- 1 | using Marten.Services.Json; 2 | using Marten.Testing.Harness; 3 | using Xunit; 4 | using Xunit.Abstractions; 5 | using Xunit.Sdk; 6 | 7 | [assembly: TestFramework("Marten.Testing.TestSetup", "Marten.Testing")] 8 | 9 | namespace Marten.Testing; 10 | 11 | public class TestSetup : XunitTestFramework 12 | { 13 | public TestSetup(IMessageSink messageSink) 14 | :base(messageSink) 15 | { 16 | SerializerFactory.DefaultSerializerType = TestsSettings.SerializerType; 17 | } 18 | } -------------------------------------------------------------------------------- /src/Marten.Testing/Weird/Task.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Testing.Weird; 4 | 5 | public class Task 6 | { 7 | public Guid Id { get; set; } 8 | public string Description { get; set; } 9 | } -------------------------------------------------------------------------------- /src/Marten/BulkInsertMode.cs: -------------------------------------------------------------------------------- 1 | namespace Marten; 2 | 3 | public enum BulkInsertMode 4 | { 5 | /// 6 | /// Default, fast mode. Will throw an exception if there are any duplicate id's with the existing data 7 | /// 8 | InsertsOnly, 9 | 10 | /// 11 | /// Will ignore any documents that already exist in the underlying table storage 12 | /// 13 | IgnoreDuplicates, 14 | 15 | /// 16 | /// Will overwrite the values of any duplicate documents (last update wins) 17 | /// 18 | OverwriteExisting 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/DocumentTracking.cs: -------------------------------------------------------------------------------- 1 | namespace Marten; 2 | 3 | public enum DocumentTracking 4 | { 5 | None, 6 | IdentityOnly, 7 | DirtyTracking, 8 | 9 | /// 10 | /// Refers to a query only session type, invalid inside of OpenSession() 11 | /// 12 | QueryOnly 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Events/Aggregation/IAggregateGrouper.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.Events.Grouping; 2 | 3 | namespace Marten.Events.Aggregation; 4 | 5 | public interface IAggregateGrouper : IJasperFxAggregateGrouper 6 | { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/Marten/Events/Aggregation/IMartenAggregateProjection.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Schema; 3 | 4 | namespace Marten.Events.Aggregation; 5 | 6 | public interface IMartenAggregateProjection 7 | { 8 | /// 9 | /// Apply any necessary configuration to the document mapping to work with the projection and append 10 | /// mode 11 | /// 12 | /// 13 | /// 14 | void ConfigureAggregateMapping(DocumentMapping mapping, StoreOptions storeOptions); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Events/Aggregation/IMessageBatch.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.Events; 2 | using JasperFx.Events.Projections; 3 | 4 | namespace Marten.Events.Aggregation; 5 | 6 | public interface IMessageBatch: IMessageSink, IChangeListener 7 | { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Events/Aggregation/IMessageOutbox.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Marten.Internal.Sessions; 3 | 4 | namespace Marten.Events.Aggregation; 5 | 6 | public interface IMessageOutbox 7 | { 8 | ValueTask CreateBatch(DocumentSessionBase session); 9 | } -------------------------------------------------------------------------------- /src/Marten/Events/Archiving/AllEventsFilter.cs: -------------------------------------------------------------------------------- 1 | using Weasel.Postgresql; 2 | 3 | namespace Marten.Events.Archiving; 4 | 5 | internal class AllEventsFilter: IArchiveFilter 6 | { 7 | public void Apply(ICommandBuilder builder) 8 | { 9 | builder.Append("1 = 1"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Events/Archiving/ArchivedEventExtensions.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.Events; 2 | 3 | namespace Marten.Events.Archiving; 4 | 5 | public static class ArchivedEventExtensions 6 | { 7 | /// 8 | /// Query for events regardless of whether they are marked 9 | /// as archived or not 10 | /// 11 | /// 12 | /// 13 | public static bool MaybeArchived(this IEvent @event) 14 | { 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Events/Archiving/IArchiveFilter.cs: -------------------------------------------------------------------------------- 1 | using Weasel.Postgresql.SqlGeneration; 2 | 3 | namespace Marten.Events.Archiving; 4 | 5 | internal interface IArchiveFilter: ISqlFragment 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /src/Marten/Events/CodeGeneration/MartenIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using JasperFx.Core; 3 | 4 | namespace Marten.Events.CodeGeneration; 5 | 6 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Property)] 7 | public class MartenIgnoreAttribute: JasperFxIgnoreAttribute 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Events/Daemon/Coordination/IProjectionDistributor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | namespace Marten.Events.Daemon.Coordination; 7 | 8 | public interface IProjectionDistributor : IAsyncDisposable 9 | { 10 | ValueTask> BuildDistributionAsync(); 11 | Task RandomWait(CancellationToken token); 12 | 13 | bool HasLock(IProjectionSet set); 14 | Task TryAttainLockAsync(IProjectionSet set, CancellationToken token); 15 | 16 | Task ReleaseLockAsync(IProjectionSet set); 17 | 18 | Task ReleaseAllLocks(); 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/Events/Daemon/Coordination/IProjectionSet.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using JasperFx.Events.Daemon; 3 | using JasperFx.Events.Projections; 4 | using Marten.Storage; 5 | 6 | namespace Marten.Events.Daemon.Coordination; 7 | 8 | public interface IProjectionSet 9 | { 10 | int LockId { get; } 11 | IMartenDatabase Database { get; } 12 | IProjectionDaemon BuildDaemon(); 13 | IReadOnlyList Names { get; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Events/Daemon/Internals/BlockExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks.Dataflow; 3 | 4 | namespace Marten.Events.Daemon.Internals; 5 | 6 | internal static class BlockExtensions 7 | { 8 | public static ExecutionDataflowBlockOptions SequentialOptions(this CancellationToken token) 9 | { 10 | return new ExecutionDataflowBlockOptions 11 | { 12 | EnsureOrdered = true, MaxDegreeOfParallelism = 1, CancellationToken = token 13 | }; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Events/Daemon/Internals/EventLoaderException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using JasperFx.Events.Projections; 3 | using Marten.Exceptions; 4 | using Marten.Storage; 5 | 6 | namespace Marten.Events.Daemon.Internals; 7 | 8 | /// 9 | /// Marten failed to load events for a projection shard 10 | /// 11 | public class EventLoaderException: MartenException 12 | { 13 | public EventLoaderException(ShardName name, IMartenDatabase martenDatabase, Exception innerException): base( 14 | $"Failure while trying to load events for projection shard '{name}@{martenDatabase.Identifier}'", 15 | innerException) 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Events/Daemon/Internals/EventRangeExtensions.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.Events.Projections; 2 | using Marten.Events.Daemon.Progress; 3 | using Marten.Internal.Operations; 4 | 5 | namespace Marten.Events.Daemon.Internals; 6 | 7 | internal static class EventRangeExtensions 8 | { 9 | internal static IStorageOperation BuildProgressionOperation(this EventRange range, EventGraph events) 10 | { 11 | if (range.SequenceFloor == 0) 12 | { 13 | return new InsertProjectionProgress(events, range); 14 | } 15 | 16 | return new UpdateProjectionProgress(events, range); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Events/EventStore.Archiving.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Marten.Events.Archiving; 4 | 5 | namespace Marten.Events; 6 | 7 | internal partial class EventStore 8 | { 9 | public void ArchiveStream(Guid streamId) 10 | { 11 | var op = new ArchiveStreamOperation(_store.Events, streamId){TenantId = _session.TenantId}; 12 | _session.QueueOperation(op); 13 | } 14 | 15 | public void ArchiveStream(string streamKey) 16 | { 17 | var op = new ArchiveStreamOperation(_store.Events, streamKey){TenantId = _session.TenantId}; 18 | _session.QueueOperation(op); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Events/Fetching/IFetchPlanner.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using Marten.Internal.Storage; 3 | 4 | namespace Marten.Events.Fetching; 5 | 6 | public interface IFetchPlanner 7 | { 8 | bool TryMatch(IDocumentStorage storage, IEventIdentityStrategy identity, 9 | StoreOptions options, [NotNullWhen(true)]out IAggregateFetchPlan? plan) where TDoc : class where TId : notnull; 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Events/Fetching/LiveFetchPlanner.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using Marten.Internal.Storage; 3 | 4 | namespace Marten.Events.Fetching; 5 | 6 | internal class LiveFetchPlanner: IFetchPlanner 7 | { 8 | public bool TryMatch(IDocumentStorage storage, IEventIdentityStrategy identity, 9 | StoreOptions options, [NotNullWhen(true)]out IAggregateFetchPlan? plan) where TDoc : class where TId : notnull 10 | { 11 | plan = new FetchLivePlan(options.EventGraph, identity, storage); 12 | return true; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Events/Projections/Flattened/ColumnMapType.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Events.Projections.Flattened; 2 | 3 | internal enum ColumnMapType 4 | { 5 | Value, 6 | Increment, 7 | Decrement 8 | } 9 | -------------------------------------------------------------------------------- /src/Marten/Events/Projections/Flattened/EventForwarder.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.Events; 2 | using Npgsql; 3 | 4 | namespace Marten.Events.Projections.Flattened; 5 | 6 | internal class EventForwarder: IParameterSetter 7 | { 8 | private readonly IParameterSetter _inner; 9 | 10 | public EventForwarder(IParameterSetter inner) 11 | { 12 | _inner = inner; 13 | } 14 | 15 | public void SetValue(NpgsqlParameter parameter, IEvent source) 16 | { 17 | _inner.SetValue(parameter, (T)source.Data); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Marten/Events/Projections/Flattened/IColumnMap.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.CodeGeneration.Model; 2 | using Weasel.Postgresql.Tables; 3 | 4 | namespace Marten.Events.Projections.Flattened; 5 | 6 | internal interface IColumnMap 7 | { 8 | string ColumnName { get; } 9 | 10 | bool RequiresInput { get; } 11 | Table.ColumnExpression ResolveColumn(Table table); 12 | 13 | string UpdateFieldSql(Table table); 14 | string ToInsertExpression(Table table); 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Events/Projections/Flattened/IEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using JasperFx.Events; 4 | using Weasel.Core; 5 | using Weasel.Postgresql.Tables; 6 | 7 | namespace Marten.Events.Projections.Flattened; 8 | 9 | internal interface IEventHandler 10 | { 11 | Type EventType { get; } 12 | 13 | bool AssertValid(EventGraph events, out string? message); 14 | 15 | IEnumerable BuildObjects(EventGraph events, Table table); 16 | 17 | void Handle(IDocumentOperations operations, IEvent e); 18 | 19 | void Compile(EventGraph events, Table table); 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Events/Projections/Flattened/IParameterSetter.cs: -------------------------------------------------------------------------------- 1 | using Npgsql; 2 | 3 | namespace Marten.Events.Projections.Flattened; 4 | 5 | internal interface IParameterSetter 6 | { 7 | void SetValue(NpgsqlParameter parameter, TSource source); 8 | } -------------------------------------------------------------------------------- /src/Marten/Events/Projections/Flattened/SchemaNameSource.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Events.Projections.Flattened; 2 | 3 | public enum SchemaNameSource 4 | { 5 | /// 6 | /// The user will supply the schema name explicitly 7 | /// 8 | Explicit, 9 | 10 | /// 11 | /// The table should be placed in the main document schema as this IDocumentStore. (StoreOptions.DatabaseSchemaName) 12 | /// 13 | DocumentSchema, 14 | 15 | /// 16 | /// The table should be placed in the designated schema for the events (StoreOptions.Events.DatabaseSchemaName) 17 | /// 18 | EventSchema 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/Events/Projections/IProjectionSchemaSource.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Weasel.Core; 3 | 4 | namespace Marten.Events.Projections; 5 | 6 | /// 7 | /// Optional interface to expose additional schema objects to be 8 | /// built as part of the event store 9 | /// 10 | public interface IProjectionSchemaSource 11 | { 12 | IEnumerable CreateSchemaObjects(EventGraph events); 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Events/Schema/EventMetadataCollection.cs: -------------------------------------------------------------------------------- 1 | using Marten.Storage.Metadata; 2 | 3 | namespace Marten.Events.Schema; 4 | 5 | public class EventMetadataCollection 6 | { 7 | public MetadataColumn CausationId { get; } = new CausationIdColumn { Enabled = false }; 8 | public MetadataColumn CorrelationId { get; } = new CorrelationIdColumn { Enabled = false }; 9 | public MetadataColumn Headers { get; } = new HeadersColumn { Enabled = false }; 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Events/Schema/VersionColumn.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using JasperFx.CodeGeneration; 3 | using JasperFx.CodeGeneration.Frames; 4 | using Npgsql; 5 | 6 | namespace Marten.Events.Schema; 7 | 8 | internal class VersionColumn: EventTableColumn 9 | { 10 | public VersionColumn() : base("version", x => x.Version) 11 | { 12 | AllowNulls = false; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Events/TestSupport/ProjectionScenarioException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using JasperFx.Core; 4 | 5 | namespace Marten.Events.TestSupport; 6 | 7 | /// 8 | /// Thrown when a ProjectionScenario fails 9 | /// 10 | public class ProjectionScenarioException: AggregateException 11 | { 12 | public ProjectionScenarioException(List descriptions, List exceptions): base( 13 | $"Event Projection Scenario Failure{Environment.NewLine}{descriptions.Join(Environment.NewLine)}", 14 | exceptions) 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Events/TestSupport/ScenarioAssertion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace Marten.Events.TestSupport; 6 | 7 | internal class ScenarioAssertion: ScenarioStep 8 | { 9 | private readonly Func _check; 10 | 11 | public ScenarioAssertion(Func check) 12 | { 13 | _check = check; 14 | } 15 | 16 | public override Task Execute(ProjectionScenario scenario, CancellationToken ct = default) 17 | { 18 | return _check(scenario.Session, ct); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Events/TestSupport/ScenarioStep.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Marten.Events.TestSupport; 5 | 6 | internal abstract class ScenarioStep 7 | { 8 | public string Description { get; set; } 9 | 10 | public abstract Task Execute(ProjectionScenario scenario, CancellationToken ct = default); 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/AmbiguousDocumentTypeAliasesException.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Exceptions; 2 | 3 | public class AmbiguousDocumentTypeAliasesException: MartenException 4 | { 5 | public AmbiguousDocumentTypeAliasesException(string message): base(message) 6 | { 7 | } 8 | 9 | #if SERIALIZE 10 | protected AmbiguousDocumentTypeAliasesException(SerializationInfo info, StreamingContext context) 11 | : base(info, context) 12 | { 13 | } 14 | #endif 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/ApplyEventException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using JasperFx.Events; 3 | using Marten.Events; 4 | 5 | namespace Marten.Exceptions; 6 | 7 | public class ApplyEventException: MartenException 8 | { 9 | public ApplyEventException(IEvent @event, Exception innerException): base( 10 | $"Failure to apply event #{@event.Sequence} Id({@event.Id})", innerException) 11 | { 12 | Event = @event; 13 | } 14 | 15 | public IEvent Event { get; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/ConcurrentUpdateException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Marten.Exceptions; 5 | 6 | public class ConcurrentUpdateException: MartenException 7 | { 8 | public ConcurrentUpdateException(Exception innerException): base( 9 | "Write collision detected while commiting the transaction.", innerException) 10 | { 11 | } 12 | 13 | protected ConcurrentUpdateException(SerializationInfo info, StreamingContext context): base(info, context) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/HiloSequenceAdvanceToNextHiAttemptsExceededException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Marten.Exceptions; 4 | 5 | public class HiloSequenceAdvanceToNextHiAttemptsExceededException: MartenException 6 | { 7 | private const string message = 8 | "Advance to next hilo sequence retry limit exceeded. Unable to secure next hi sequence"; 9 | 10 | public HiloSequenceAdvanceToNextHiAttemptsExceededException(): base(message) 11 | { 12 | } 13 | 14 | protected HiloSequenceAdvanceToNextHiAttemptsExceededException(SerializationInfo info, StreamingContext context): 15 | base(info, context) 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/InvalidDocumentException.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Exceptions; 2 | #if SERIALIZE 3 | [Serializable] 4 | #endif 5 | 6 | public class InvalidDocumentException: MartenException 7 | { 8 | public InvalidDocumentException(string message): base(message) 9 | { 10 | } 11 | 12 | #if SERIALIZE 13 | protected InvalidDocumentException(SerializationInfo info, StreamingContext context) : base(info, context) 14 | { 15 | } 16 | #endif 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/InvalidStreamOperationException.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Exceptions; 2 | 3 | public class InvalidStreamOperationException: MartenException 4 | { 5 | public InvalidStreamOperationException(string message): 6 | base(message) 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/InvalidTenantForDatabaseException.cs: -------------------------------------------------------------------------------- 1 | using Marten.Storage; 2 | 3 | namespace Marten.Exceptions; 4 | 5 | public class InvalidTenantForDatabaseException : MartenException 6 | { 7 | public InvalidTenantForDatabaseException(string tenantId, IMartenDatabase database) : base($"Tenant Id '{tenantId}' is not stored in the current database '{database.Identifier}'") 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/MartenException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Marten.Exceptions; 5 | 6 | /// 7 | /// Base class for all Marten related exceptions 8 | /// 9 | public class MartenException: Exception 10 | { 11 | public MartenException() 12 | { 13 | } 14 | 15 | protected MartenException(SerializationInfo info, StreamingContext context): base(info, context) 16 | { 17 | } 18 | 19 | public MartenException(string message): base(message) 20 | { 21 | } 22 | 23 | public MartenException(string message, Exception innerException): base(message, innerException) 24 | { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/MartenNotSupportedException.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Exceptions; 2 | 3 | public sealed class MartenNotSupportedException(string message) : MartenException(message); 4 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/MartenSchemaException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Exceptions; 4 | #if SERIALIZE 5 | [Serializable] 6 | #endif 7 | 8 | public class MartenSchemaException: MartenException 9 | { 10 | public MartenSchemaException(object subject, string ddl, Exception inner): base( 11 | $"DDL Execution for '{subject}' Failed!\n\n{ddl}", inner) 12 | { 13 | } 14 | 15 | #if SERIALIZE 16 | protected MartenSchemaException(SerializationInfo info, StreamingContext context) : base(info, context) 17 | { 18 | } 19 | #endif 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/NonExistentDocumentException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Marten.Exceptions; 5 | 6 | public class NonExistentDocumentException: MartenException 7 | { 8 | public NonExistentDocumentException(Type docType, object id): base($"Nonexistent document {docType.FullName}: {id}") 9 | { 10 | DocType = docType; 11 | Id = id; 12 | } 13 | 14 | protected NonExistentDocumentException(SerializationInfo info, StreamingContext context): base(info, context) 15 | { 16 | } 17 | 18 | public Type DocType { get; } 19 | public object Id { get; } 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/NonExistentStreamException.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Exceptions; 2 | 3 | public class NonExistentStreamException: MartenException 4 | { 5 | public NonExistentStreamException(object id): base($"Attempt to append to a nonexistent event stream '{id}'") 6 | { 7 | Id = id; 8 | } 9 | 10 | public object Id { get; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/RollbackException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Marten.Exceptions; 5 | 6 | public class RollbackException: MartenException 7 | { 8 | public RollbackException(Exception innerException): base("Failed while trying to rollback an exception", 9 | innerException) 10 | { 11 | } 12 | 13 | protected RollbackException(SerializationInfo info, StreamingContext context): base(info, context) 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/StreamLockedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Exceptions; 4 | 5 | public class StreamLockedException: MartenException 6 | { 7 | public StreamLockedException(object streamId, Exception innerException): base( 8 | $"Stream '{streamId}' may be locked for updates", innerException) 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Exceptions/UnknownEventTypeException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Marten.Exceptions; 4 | 5 | public class UnknownEventTypeException: MartenException 6 | { 7 | public string EventTypeName { get; } 8 | 9 | public UnknownEventTypeException(string eventTypeName): base( 10 | $"Unknown event type name alias '{eventTypeName}.' You may need to register this event type through StoreOptions.Events.AddEventType(type)") 11 | { 12 | EventTypeName = eventTypeName; 13 | } 14 | 15 | protected UnknownEventTypeException(SerializationInfo info, StreamingContext context): base(info, context) 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/IDocumentPolicy.cs: -------------------------------------------------------------------------------- 1 | using Marten.Schema; 2 | 3 | namespace Marten; 4 | 5 | /// 6 | /// Represents a pluggable configuration convention for all persisted documents 7 | /// 8 | public interface IDocumentPolicy 9 | { 10 | void Apply(DocumentMapping mapping); 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/ITenantOperations.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten; 3 | 4 | /// 5 | /// Access to querying or registering updates for a separate tenant 6 | /// to a parent IDocumentSession 7 | /// 8 | public interface ITenantOperations: IDocumentOperations 9 | { 10 | /// 11 | /// The tenant id of this tenant operations 12 | /// 13 | string TenantId { get; } 14 | 15 | IDocumentSession Parent { get; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/ITenantQueryOperations.cs: -------------------------------------------------------------------------------- 1 | namespace Marten; 2 | 3 | /// 4 | /// Access to querying or registering updates for a separate tenant 5 | /// to a parent IDocumentSession 6 | /// 7 | public interface ITenantQueryOperations: IQuerySession 8 | { 9 | /// 10 | /// The tenant id of this tenant operations 11 | /// 12 | string TenantId { get; } 13 | 14 | IQuerySession Parent { get; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Internal/CodeGeneration/DocumentSelectorWithOnlySerializer.cs: -------------------------------------------------------------------------------- 1 | using Marten.Schema; 2 | 3 | namespace Marten.Internal.CodeGeneration; 4 | 5 | public abstract class DocumentSelectorWithOnlySerializer: IDocumentSelector 6 | { 7 | protected readonly DocumentMapping _mapping; 8 | protected readonly ISerializer _serializer; 9 | 10 | public DocumentSelectorWithOnlySerializer(IMartenSession session, DocumentMapping mapping) 11 | { 12 | _mapping = mapping; 13 | _serializer = session.Serializer; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Internal/CodeGeneration/IDocumentSelector.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Internal.CodeGeneration; 2 | 3 | /// 4 | /// Strictly a marker interface that tells the compiled query 5 | /// generation to use a new selector per session 6 | /// 7 | internal interface IDocumentSelector 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Internal/CodeGeneration/StorageStyle.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Internal.CodeGeneration; 2 | 3 | public enum StorageStyle 4 | { 5 | QueryOnly, 6 | Lightweight, 7 | IdentityMap, 8 | DirtyTracking 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Internal/CodeGeneration/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text.RegularExpressions; 4 | using JasperFx.Core; 5 | 6 | namespace Marten.Internal.CodeGeneration; 7 | 8 | public static class StringExtensions 9 | { 10 | public static string ToTypeNamePart(this Type type) 11 | { 12 | if (type.IsGenericType) 13 | { 14 | return type.Name.Split('`').First() + "_of_" + 15 | type.GetGenericArguments().Select(x => x.ToTypeNamePart()).Join("_"); 16 | } 17 | 18 | return type.Name; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Internal/CompiledQueries/CommandPlan.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Marten.Internal.CompiledQueries; 4 | 5 | internal class CommandPlan 6 | { 7 | public string CommandText { get; set; } = string.Empty; 8 | public List Parameters { get; } = new(); 9 | } -------------------------------------------------------------------------------- /src/Marten/Internal/CompiledQueries/CompiledQuerySource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Marten.Linq.QueryHandlers; 3 | 4 | namespace Marten.Internal.CompiledQueries; 5 | 6 | public abstract class CompiledQuerySource: ICompiledQuerySource 7 | { 8 | public Type QueryType => typeof(TQuery); 9 | 10 | public IQueryHandler Build(object query, IMartenSession session) 11 | { 12 | return BuildHandler((TQuery)query, session); 13 | } 14 | 15 | public abstract IQueryHandler BuildHandler(TQuery query, IMartenSession session); 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Internal/CompiledQueries/CompiledSourceType.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Internal.CompiledQueries; 2 | 3 | internal enum CompiledSourceType 4 | { 5 | Stateless, 6 | Complex, 7 | Cloneable 8 | } 9 | -------------------------------------------------------------------------------- /src/Marten/Internal/CompiledQueries/ICompiledQueryAwareFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using JasperFx.CodeGeneration; 3 | 4 | namespace Marten.Internal.CompiledQueries; 5 | 6 | /// 7 | /// This marker interface is used for SQL fragment filters where 8 | /// there needs to be some special handling within compiled queries 9 | /// 10 | public interface ICompiledQueryAwareFilter 11 | { 12 | bool TryMatchValue(object value, MemberInfo member); 13 | void GenerateCode(GeneratedMethod method, int parameterIndex, string parametersVariableName); 14 | 15 | string ParameterName { get; } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Internal/CompiledQueries/ICompiledQuerySource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Marten.Linq.QueryHandlers; 3 | 4 | namespace Marten.Internal.CompiledQueries; 5 | 6 | public interface ICompiledQuerySource 7 | { 8 | Type QueryType { get; } 9 | IQueryHandler Build(object query, IMartenSession session); 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Internal/CompiledQueries/IParameterFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Marten.Internal.CompiledQueries; 5 | 6 | internal interface IParameterFinder 7 | { 8 | bool Matches(Type memberType); 9 | bool AreValuesUnique(object query, CompiledQueryPlan plan); 10 | Queue UniqueValueQueue(Type type); 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Internal/IUpdateBatch.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | using Marten.Internal.Sessions; 6 | 7 | namespace Marten.Internal; 8 | 9 | public interface IUpdateBatch 10 | { 11 | IReadOnlyList BuildPages(IMartenSession session); 12 | 13 | IReadOnlyList DocumentTypes(); 14 | Task PostUpdateAsync(IMartenSession session); 15 | Task PreUpdateAsync(IMartenSession session); 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Internal/Operations/IDocumentStorageOperation.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Internal.DirtyTracking; 3 | 4 | namespace Marten.Internal.Operations; 5 | 6 | public interface IDocumentStorageOperation: IStorageOperation 7 | { 8 | object Document { get; } 9 | IChangeTracker ToTracker(IMartenSession session); 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Internal/Operations/IStorageOperation.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Data.Common; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Marten.Linq.QueryHandlers; 8 | 9 | namespace Marten.Internal.Operations; 10 | 11 | public interface IStorageOperation: IQueryHandler 12 | { 13 | Type DocumentType { get; } 14 | 15 | void Postprocess(DbDataReader reader, IList exceptions); 16 | 17 | Task PostprocessAsync(DbDataReader reader, IList exceptions, CancellationToken token); 18 | 19 | OperationRole Role(); 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Internal/Operations/OperationRole.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Internal.Operations; 2 | 3 | public enum OperationRole 4 | { 5 | Upsert, 6 | Insert, 7 | Update, 8 | Deletion, 9 | Patch, 10 | Other, 11 | Events 12 | } 13 | -------------------------------------------------------------------------------- /src/Marten/Internal/Storage/DirtyCheckedDocumentStorage.cs: -------------------------------------------------------------------------------- 1 | using Marten.Internal.CodeGeneration; 2 | using Marten.Schema; 3 | 4 | namespace Marten.Internal.Storage; 5 | 6 | public abstract class DirtyCheckedDocumentStorage: IdentityMapDocumentStorage where TId : notnull where T : notnull 7 | { 8 | public DirtyCheckedDocumentStorage(DocumentMapping document): base(StorageStyle.DirtyTracking, document) 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Internal/ValueTypeElementMember.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Marten.Linq.Members.ValueCollections; 3 | 4 | namespace Marten.Internal; 5 | 6 | internal class ValueTypeElementMember: ElementMember 7 | { 8 | public ValueTypeElementMember(Type declaringType, Type reflectedType) : base(declaringType, reflectedType) 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/Marten/Linq/ILinqQuery.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Linq.Expressions; 4 | 5 | namespace Marten.Linq; 6 | 7 | public interface ILinqQuery 8 | { 9 | CollectionUsage CurrentUsage { get; } 10 | CollectionUsage CollectionUsageFor(MethodCallExpression expression); 11 | CollectionUsage CollectionUsageForArgument(Expression argument); 12 | CollectionUsage StartNewCollectionUsageFor(MethodCallExpression expression); 13 | CollectionUsage CollectionUsageFor(Type elementType); 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Linq/Includes/IIncludePlan.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Linq.Expressions; 4 | using Marten.Internal; 5 | using Marten.Linq.SqlGeneration.Filters; 6 | 7 | namespace Marten.Linq.Includes; 8 | 9 | public interface IIncludePlan 10 | { 11 | Type DocumentType { get; } 12 | Expression Where { get; set; } 13 | IIncludeReader BuildReader(IMartenSession session); 14 | 15 | void AppendStatement(TemporaryTableStatement tempTable, IMartenSession martenSession, 16 | ITenantFilter tenantFilter); 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Linq/Includes/IIncludeReader.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Data.Common; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | namespace Marten.Linq.Includes; 7 | 8 | /// 9 | /// Used internally to process Include() operations 10 | /// in the Linq support 11 | /// 12 | public interface IIncludeReader 13 | { 14 | void Read(DbDataReader reader); 15 | Task ReadAsync(DbDataReader reader, CancellationToken token); 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Linq/Includes/ListIncludePlan.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using Marten.Internal.Storage; 4 | using Marten.Linq.Members; 5 | 6 | namespace Marten.Linq.Includes; 7 | 8 | internal class ListIncludePlan: IncludePlan where T : notnull 9 | { 10 | public ListIncludePlan(IDocumentStorage storage, IQueryableMember connectingMember, IList list): base(storage, 11 | connectingMember, list.Add) 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/BooleanMember.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Reflection; 3 | using Marten.Linq.SqlGeneration.Filters; 4 | using Weasel.Postgresql.SqlGeneration; 5 | 6 | namespace Marten.Linq.Members; 7 | 8 | internal class BooleanMember: QueryableMember, IComparableMember, IBooleanMember 9 | { 10 | public BooleanMember(IQueryableMember parent, Casing casing, MemberInfo member, string pgType): base(parent, 11 | casing, member) 12 | { 13 | TypedLocator = $"CAST({RawLocator} as {pgType})"; 14 | } 15 | 16 | public ISqlFragment BuildIsTrueFragment() 17 | { 18 | return new BooleanFieldIsTrue(this); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/Dictionaries/IDictionaryMember.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Linq.Members.Dictionaries; 5 | 6 | internal interface IDictionaryMember : ICollectionMember 7 | { 8 | IQueryableMember MemberForKey(object keyValue); 9 | 10 | Type ValueType { get; } 11 | Type KeyType { get; } 12 | DictionaryCountMember Count { get; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/FSharpOptionValueTypeMember.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using JasperFx.Core.Reflection; 5 | using Marten.Internal; 6 | using Marten.Linq.SqlGeneration; 7 | using Microsoft.FSharp.Core; 8 | 9 | namespace Marten.Linq.Members; 10 | 11 | public class FSharpOptionValueTypeMember : ValueTypeMember, TOption>, IComparableMember 12 | { 13 | public FSharpOptionValueTypeMember(IQueryableMember parent, Casing casing, MemberInfo member, ValueTypeInfo valueTypeInfo) : base(parent, casing, member, valueTypeInfo) 14 | { 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/IBooleanMember.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Weasel.Postgresql.SqlGeneration; 3 | 4 | namespace Marten.Linq.Members; 5 | 6 | internal interface IBooleanMember 7 | { 8 | ISqlFragment BuildIsTrueFragment(); 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/IComparableMember.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq.Expressions; 3 | using Weasel.Postgresql.SqlGeneration; 4 | 5 | namespace Marten.Linq.Members; 6 | 7 | public interface IComparableMember 8 | { 9 | ISqlFragment CreateComparison(string op, ConstantExpression constant); 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/IHasChildrenMembers.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Reflection; 3 | 4 | namespace Marten.Linq.Members; 5 | 6 | public interface IHasChildrenMembers 7 | { 8 | IQueryableMember FindMember(MemberInfo member); 9 | void ReplaceMember(MemberInfo member, IQueryableMember queryableMember); 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/IMemberSource.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Reflection; 5 | 6 | namespace Marten.Linq.Members; 7 | 8 | /// 9 | /// An extension point to "teach" Marten how to support new member types in the Linq support 10 | /// 11 | public interface IMemberSource 12 | { 13 | bool TryResolve(IQueryableMember parent, StoreOptions options, 14 | MemberInfo memberInfo, Type memberType, [NotNullWhen(true)] out IQueryableMember? member); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/IQueryableMemberCollection.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace Marten.Linq.Members; 6 | 7 | public interface IQueryableMemberCollection: IHasChildrenMembers, IEnumerable 8 | { 9 | Type ElementType { get; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/NotMember.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq.Expressions; 3 | using Weasel.Postgresql.SqlGeneration; 4 | 5 | namespace Marten.Linq.Members; 6 | 7 | internal class NotMember: IComparableMember 8 | { 9 | public NotMember(IComparableMember inner) 10 | { 11 | Inner = inner; 12 | } 13 | 14 | public IComparableMember Inner { get; } 15 | 16 | public ISqlFragment CreateComparison(string op, ConstantExpression constant) 17 | { 18 | var opposite = ComparisonFilter.NotOperators[op]; 19 | return Inner.CreateComparison(opposite, constant); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/ScalarSelectManyStatement.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Linq.SqlGeneration; 3 | using Weasel.Postgresql; 4 | 5 | namespace Marten.Linq.Members; 6 | 7 | internal class ScalarSelectManyStatement: SelectorStatement where T : struct 8 | { 9 | public ScalarSelectManyStatement(SelectorStatement parent, ISerializer serializer) 10 | { 11 | SelectClause = new ScalarSelectClause(ToLocator(serializer), parent.ExportName); 12 | } 13 | 14 | public static string ToLocator(ISerializer serializer) 15 | { 16 | return $"CAST(data as {PostgresqlProvider.Instance.GetDatabaseType(typeof(T), serializer.EnumStorage)})"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/ScalarSelectManyStringStatement.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Linq.SqlGeneration; 3 | 4 | namespace Marten.Linq.Members; 5 | 6 | internal class ScalarSelectManyStringStatement: SelectorStatement 7 | { 8 | public ScalarSelectManyStringStatement(SelectorStatement parent) 9 | { 10 | SelectClause = new ScalarStringSelectClause("data", parent.ExportName); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Marten/Linq/Members/ValueCollections/IValueCollectionMember.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq.Members.ValueCollections; 3 | 4 | internal interface IValueCollectionMember : IQueryableMemberCollection 5 | { 6 | public IQueryableMember Element { get; } 7 | } 8 | -------------------------------------------------------------------------------- /src/Marten/Linq/OrderingDirection.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq; 3 | 4 | /// 5 | /// Specifies the direction used to sort the result items in a query using an . 6 | /// 7 | public enum OrderingDirection 8 | { 9 | /// 10 | /// Sorts the items in an ascending way, from smallest to largest. 11 | /// 12 | Asc, 13 | /// 14 | /// Sorts the items in an descending way, from largest to smallest. 15 | /// 16 | Desc, 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Methods/FullText/PhraseSearch.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq.Parsing.Methods.FullText; 3 | 4 | internal class PhraseSearch: FullTextSearchMethodCallParser 5 | { 6 | public PhraseSearch(): base(nameof(LinqExtensions.PhraseSearch), FullTextSearchFunction.phraseto_tsquery) 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Methods/FullText/PlainTextSearch.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq.Parsing.Methods.FullText; 3 | 4 | internal class PlainTextSearch: FullTextSearchMethodCallParser 5 | { 6 | public PlainTextSearch(): base(nameof(LinqExtensions.PlainTextSearch), FullTextSearchFunction.plainto_tsquery) 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Methods/FullText/Search.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq.Parsing.Methods.FullText; 3 | 4 | internal class Search: FullTextSearchMethodCallParser 5 | { 6 | public Search(): base(nameof(LinqExtensions.Search), FullTextSearchFunction.to_tsquery) 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Methods/FullText/WebStyleSearch.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq.Parsing.Methods.FullText; 3 | 4 | internal class WebStyleSearch: FullTextSearchMethodCallParser 5 | { 6 | public WebStyleSearch(): base(nameof(LinqExtensions.WebStyleSearch), FullTextSearchFunction.websearch_to_tsquery) 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Operators/AnyOperator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq.Expressions; 3 | 4 | namespace Marten.Linq.Parsing.Operators; 5 | 6 | internal class AnyOperator: LinqOperator 7 | { 8 | public AnyOperator(): base("Any") 9 | { 10 | } 11 | 12 | public override void Apply(ILinqQuery query, MethodCallExpression expression) 13 | { 14 | var usage = query.CollectionUsageFor(expression); 15 | usage.AddWhereClause(expression); 16 | usage.IsAny = true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Operators/CasingRule.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Linq.Parsing.Operators; 2 | 3 | public enum CasingRule 4 | { 5 | CaseSensitive, 6 | CaseInsensitive 7 | } 8 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Operators/DistinctOperator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq.Expressions; 3 | 4 | namespace Marten.Linq.Parsing.Operators; 5 | 6 | internal class DistinctOperator: LinqOperator 7 | { 8 | public DistinctOperator(): base("Distinct") 9 | { 10 | } 11 | 12 | public override void Apply(ILinqQuery query, MethodCallExpression expression) 13 | { 14 | var usage = query.CollectionUsageFor(expression); 15 | usage.IsDistinct = true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Operators/LinqOperator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq.Expressions; 3 | 4 | namespace Marten.Linq.Parsing.Operators; 5 | 6 | public abstract class LinqOperator 7 | { 8 | public LinqOperator(string methodName) 9 | { 10 | MethodName = methodName; 11 | } 12 | 13 | public string MethodName { get; } 14 | 15 | public abstract void Apply(ILinqQuery query, MethodCallExpression expression); 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Operators/SelectManyOperator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | 5 | namespace Marten.Linq.Parsing.Operators; 6 | 7 | public class SelectManyOperator: LinqOperator 8 | { 9 | public SelectManyOperator(): base("SelectMany") 10 | { 11 | } 12 | 13 | public override void Apply(ILinqQuery query, MethodCallExpression expression) 14 | { 15 | var usage = query.StartNewCollectionUsageFor(expression); 16 | usage.SelectMany = expression.Arguments.Last(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Operators/SkipOperator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | using JasperFx.Core.Reflection; 5 | 6 | namespace Marten.Linq.Parsing.Operators; 7 | 8 | public class SkipOperator: LinqOperator 9 | { 10 | public SkipOperator(): base("Skip") 11 | { 12 | } 13 | 14 | public override void Apply(ILinqQuery query, MethodCallExpression expression) 15 | { 16 | var usage = query.CollectionUsageFor(expression); 17 | usage.WriteOffset(expression.Arguments.Last().Value().As()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/Operators/TakeOperator.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | using JasperFx.Core.Reflection; 5 | 6 | namespace Marten.Linq.Parsing.Operators; 7 | 8 | public class TakeOperator: LinqOperator 9 | { 10 | public TakeOperator(): base("Take") 11 | { 12 | } 13 | 14 | public override void Apply(ILinqQuery query, MethodCallExpression expression) 15 | { 16 | var usage = query.CollectionUsageFor(expression); 17 | usage.WriteLimit(expression.Arguments.Last().Value().As()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/Linq/Parsing/SingleValueMode.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Linq.Parsing; 2 | 3 | public enum SingleValueMode 4 | { 5 | First = 1, 6 | FirstOrDefault = 2, 7 | Single = 3, 8 | SingleOrDefault = 4, 9 | Count = 5, 10 | LongCount = 6, 11 | Any = 7, 12 | 13 | Average = 11, 14 | Sum = 12, 15 | Max = 13, 16 | Min = 14 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Linq/QueryStatistics.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq; 3 | 4 | /// 5 | /// Used to supply the total number of rows in the database for server side 6 | /// paging scenarios 7 | /// 8 | public class QueryStatistics 9 | { 10 | /// 11 | /// The total number of records in the database for this query 12 | /// 13 | public long TotalResults { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Linq/Selectors/ISelector.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Data.Common; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | namespace Marten.Linq.Selectors; 7 | 8 | public interface ISelector 9 | { 10 | } 11 | 12 | public interface ISelector: ISelector 13 | { 14 | T Resolve(DbDataReader reader); 15 | 16 | Task ResolveAsync(DbDataReader reader, CancellationToken token); 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/Filters/EqualsFilter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Weasel.Postgresql; 3 | using Weasel.Postgresql.SqlGeneration; 4 | 5 | namespace Marten.Linq.SqlGeneration.Filters; 6 | 7 | public record EqualsFilter(string Locator, object Value): ISqlFragment 8 | { 9 | public void Apply(ICommandBuilder builder) 10 | { 11 | builder.Append(Locator); 12 | builder.Append(" = "); 13 | builder.AppendParameter(Value); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/Filters/ExcludeSoftDeletedFilter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Schema; 3 | using Weasel.Postgresql; 4 | using Weasel.Postgresql.SqlGeneration; 5 | 6 | namespace Marten.Linq.SqlGeneration.Filters; 7 | 8 | 9 | internal interface ISoftDeletedFilter: ISqlFragment 10 | { 11 | 12 | } 13 | 14 | internal class ExcludeSoftDeletedFilter: ISoftDeletedFilter 15 | { 16 | public static readonly ExcludeSoftDeletedFilter Instance = new(); 17 | 18 | private static string _sql = $"d.{SchemaConstants.DeletedColumn} = False"; 19 | 20 | public void Apply(ICommandBuilder builder) 21 | { 22 | builder.Append(_sql); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/Filters/ITenantFilter.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Weasel.Postgresql.SqlGeneration; 3 | 4 | namespace Marten.Linq.SqlGeneration.Filters; 5 | 6 | /// 7 | /// Marker interface to help Marten track whether or not a Linq 8 | /// query has some kind of tenant-aware filtering 9 | /// 10 | public interface ITenantFilter : ISqlFragment 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/HardDelete.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Internal.Operations; 3 | using Marten.Internal.Storage; 4 | using Weasel.Postgresql; 5 | 6 | namespace Marten.Linq.SqlGeneration; 7 | 8 | internal class HardDelete: IOperationFragment 9 | { 10 | private readonly string _sql; 11 | 12 | public HardDelete(IDocumentStorage storage) 13 | { 14 | _sql = $"delete from {storage.TableName} as d"; 15 | } 16 | 17 | public void Apply(ICommandBuilder builder) 18 | { 19 | builder.Append(_sql); 20 | } 21 | 22 | public OperationRole Role() 23 | { 24 | return OperationRole.Deletion; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/IOperationFragment.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Internal.Operations; 3 | using Weasel.Postgresql.SqlGeneration; 4 | 5 | namespace Marten.Linq.SqlGeneration; 6 | 7 | /// 8 | /// Internal marker interface for organizing operations 9 | /// 10 | public interface IOperationFragment: ISqlFragment 11 | { 12 | OperationRole Role(); 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/IScalarSelectClause.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Linq.SqlGeneration; 3 | 4 | public interface IScalarSelectClause 5 | { 6 | string MemberName { get; } 7 | void ApplyOperator(string op); 8 | ISelectClause CloneToDouble(); 9 | 10 | ISelectClause CloneToOtherTable(string tableName); 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/Literal.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Weasel.Postgresql; 3 | using Weasel.Postgresql.SqlGeneration; 4 | 5 | namespace Marten.Linq.SqlGeneration; 6 | 7 | /// 8 | /// Exactly what it sounds like, represents a little bit 9 | /// of literal SQL within a bigger statement 10 | /// 11 | /// 12 | // TODO -- move this to Weasel itself 13 | public record LiteralSql(string Text) : ISqlFragment 14 | { 15 | public void Apply(ICommandBuilder builder) 16 | { 17 | builder.Append(Text); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Linq/SqlGeneration/StatementMode.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Linq.SqlGeneration; 2 | 3 | public enum StatementMode 4 | { 5 | Select, 6 | CommonTableExpression, 7 | Inner 8 | } 9 | -------------------------------------------------------------------------------- /src/Marten/Metadata/IRevisioned.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Metadata; 3 | 4 | /// 5 | /// Optionally implement this interface on your Marten document 6 | /// types to opt into optimistic concurrency with the version 7 | /// being tracked on the Version property using numeric revision values 8 | /// 9 | public interface IRevisioned 10 | { 11 | /// 12 | /// Marten's version for this document 13 | /// 14 | int Version { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Metadata/ITenanted.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using JasperFx; 3 | using JasperFx.MultiTenancy; 4 | 5 | namespace Marten.Metadata; 6 | 7 | /// 8 | /// Optionally implement this interface on your Marten document 9 | /// types to opt into conjoined tenancy and track the tenant id 10 | /// on the document itself 11 | /// 12 | public interface ITenanted : IHasTenantId 13 | { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Metadata/IVersioned.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Metadata; 5 | 6 | /// 7 | /// Optionally implement this interface on your Marten document 8 | /// types to opt into optimistic concurrency with the version 9 | /// being tracked on the Version property 10 | /// 11 | public interface IVersioned 12 | { 13 | /// 14 | /// Marten's version for this document 15 | /// 16 | Guid Version { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Metadata/TenancyPolicy.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using JasperFx.Core.Reflection; 3 | using Marten.Schema; 4 | using Marten.Storage; 5 | 6 | namespace Marten.Metadata; 7 | 8 | internal class TenancyPolicy: IDocumentPolicy 9 | { 10 | public void Apply(DocumentMapping mapping) 11 | { 12 | if (mapping.DocumentType.CanBeCastTo()) 13 | { 14 | mapping.TenancyStyle = TenancyStyle.Conjoined; 15 | mapping.Metadata.TenantId.Enabled = true; 16 | mapping.Metadata.TenantId.Member = mapping.DocumentType.GetProperty(nameof(ITenanted.TenantId)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/NulloMartenLogger.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging.Abstractions; 2 | 3 | namespace Marten; 4 | 5 | internal class NulloMartenLogger: DefaultMartenLogger 6 | { 7 | public NulloMartenLogger(): base(NullLogger.Instance) 8 | { 9 | } 10 | 11 | public static IMartenSessionLogger Flyweight { get; } = new NulloMartenLogger(); 12 | } 13 | -------------------------------------------------------------------------------- /src/Marten/Patching/RemoveAction.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Patching; 2 | 3 | public enum RemoveAction 4 | { 5 | /// 6 | /// Remove the first occurrence 7 | /// 8 | RemoveFirst, 9 | 10 | /// 11 | /// Remove all occurrences 12 | /// 13 | RemoveAll 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Schema/ColumnValue.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Schema; 2 | 3 | public class ColumnValue 4 | { 5 | public ColumnValue(string column, string functionValue) 6 | { 7 | Column = column; 8 | FunctionValue = functionValue; 9 | } 10 | 11 | public string Column { get; } 12 | public string FunctionValue { get; } 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Schema/DatabaseSchemaNameAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Schema; 4 | 5 | /// 6 | /// Overrides the database schema name for the document type 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class DatabaseSchemaNameAttribute: MartenDocumentAttribute 10 | { 11 | private readonly string _name; 12 | 13 | public DatabaseSchemaNameAttribute(string name) 14 | { 15 | _name = name; 16 | } 17 | 18 | public override void Modify(DocumentMapping mapping) 19 | { 20 | mapping.DatabaseSchemaName = _name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Marten/Schema/DdlTemplateAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Marten.Schema; 4 | 5 | /// 6 | /// Override the DDL template for a single document type 7 | /// 8 | [AttributeUsage(AttributeTargets.Class)] 9 | public class DdlTemplateAttribute: MartenAttribute 10 | { 11 | private readonly string _templateName; 12 | 13 | public DdlTemplateAttribute(string templateName) 14 | { 15 | _templateName = templateName; 16 | } 17 | 18 | public override void Modify(DocumentMapping mapping) 19 | { 20 | mapping.DdlTemplate = _templateName; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Marten/Schema/DeleteStyle.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Schema; 2 | 3 | public enum DeleteStyle 4 | { 5 | Remove, 6 | SoftDelete 7 | } 8 | -------------------------------------------------------------------------------- /src/Marten/Schema/DoNotPartitionAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Directs Marten to ignore any kind of table partitioning policy 8 | /// for just this document type 9 | /// 10 | [AttributeUsage(AttributeTargets.Class)] 11 | public class DoNotPartitionAttribute: MartenAttribute 12 | { 13 | public override void Modify(DocumentMapping mapping) 14 | { 15 | mapping.DisablePartitioningIfAny = true; 16 | mapping.Partitioning = null; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Schema/ForeignKeyConstraint.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Schema; 2 | 3 | public class ForeignKeyConstraint 4 | { 5 | public ForeignKeyConstraint(string name, string schema, string tableName) 6 | { 7 | Name = name; 8 | Schema = schema; 9 | TableName = tableName; 10 | } 11 | 12 | public string Name { get; } 13 | public string Schema { get; } 14 | public string TableName { get; } 15 | 16 | public override string ToString() 17 | { 18 | return $"{nameof(Name)}: {Name}, {nameof(Schema)}: {Schema}, {nameof(TableName)}: {TableName}"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Marten/Schema/GinIndexedAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Adds a gin index to the JSONB data of a document 8 | /// 9 | 10 | #region sample_GinIndexedAttribute 11 | 12 | [AttributeUsage(AttributeTargets.Class)] 13 | public class GinIndexedAttribute: MartenAttribute 14 | { 15 | public override void Modify(DocumentMapping mapping) 16 | { 17 | mapping.AddGinIndexToData(); 18 | } 19 | } 20 | 21 | #endregion 22 | -------------------------------------------------------------------------------- /src/Marten/Schema/IInitialData.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace Marten.Schema; 6 | 7 | /// 8 | /// A set of initial data to pre-populate a DocumentStore at startup time 9 | /// Users will have to be responsible for not duplicating data 10 | /// 11 | public interface IInitialData 12 | { 13 | /// 14 | /// Apply the data loading 15 | /// 16 | /// 17 | Task Populate(IDocumentStore store, CancellationToken cancellation); 18 | } 19 | -------------------------------------------------------------------------------- /src/Marten/Schema/Identity/NoOpIdGeneration.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Collections.Generic; 4 | using JasperFx.CodeGeneration; 5 | using JasperFx.CodeGeneration.Frames; 6 | 7 | namespace Marten.Schema.Identity; 8 | 9 | /// 10 | /// User-assigned identity strategy 11 | /// 12 | public class NoOpIdGeneration: IIdGeneration 13 | { 14 | public bool IsNumeric => false; 15 | 16 | public void GenerateCode(GeneratedMethod method, DocumentMapping mapping) 17 | { 18 | var document = new Use(mapping.DocumentType); 19 | method.Frames.Code($"return {{0}}.{mapping.IdMember.Name};", document); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Marten/Schema/Identity/Sequences/HiloSettings.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Schema.Identity.Sequences; 3 | 4 | public interface IReadOnlyHiloSettings 5 | { 6 | int MaxLo { get; } 7 | string? SequenceName { get; } 8 | int MaxAdvanceToNextHiAttempts { get; } 9 | } 10 | 11 | public class HiloSettings: IReadOnlyHiloSettings 12 | { 13 | public int MaxLo { get; set; } = 1000; 14 | public string? SequenceName { get; set; } = null; 15 | public int MaxAdvanceToNextHiAttempts { get; set; } = 30; 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Schema/Identity/Sequences/ISequence.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Threading.Tasks; 3 | 4 | namespace Marten.Schema.Identity.Sequences; 5 | 6 | public interface ISequence 7 | { 8 | int MaxLo { get; } 9 | int NextInt(); 10 | 11 | long NextLong(); 12 | 13 | Task SetFloor(long floor); 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Schema/Identity/Sequences/ISequences.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Weasel.Core.Migrations; 4 | 5 | namespace Marten.Schema.Identity.Sequences; 6 | 7 | public interface ISequences: IFeatureSchema 8 | { 9 | ISequence Hilo(Type documentType, HiloSettings settings); 10 | 11 | ISequence SequenceFor(Type documentType); 12 | } 13 | -------------------------------------------------------------------------------- /src/Marten/Schema/IdentityAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Use to designate an Id property or field on a document type that doesn't follow the 8 | /// id/Id naming convention 9 | /// 10 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] 11 | public class IdentityAttribute: MartenAttribute 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Schema/IndexedCreatedAtAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Creates an index on the predefined Last Modified column 8 | /// 9 | [AttributeUsage(AttributeTargets.Class)] 10 | public class IndexedCreatedAtAttribute: MartenAttribute 11 | { 12 | public override void Modify(DocumentMapping mapping) 13 | { 14 | mapping.AddCreatedAtIndex(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Schema/IndexedLastModifiedAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Creates an index on the predefined Last Modified column 8 | /// 9 | [AttributeUsage(AttributeTargets.Class)] 10 | public class IndexedLastModifiedAttribute: MartenAttribute 11 | { 12 | public override void Modify(DocumentMapping mapping) 13 | { 14 | mapping.AddLastModifiedIndex(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Schema/Indexing/Unique/TenancyScope.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Schema.Indexing.Unique; 3 | 4 | public enum TenancyScope 5 | { 6 | /// 7 | /// The uniqueness of this index should be global for all tenants 8 | /// 9 | Global, 10 | 11 | /// 12 | /// The uniqueness of this index should be within one tenant 13 | /// 14 | PerTenant 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Schema/MartenDocumentAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Just marks a type as being a persisted Marten document for the AutoRegister() 8 | /// feature 9 | /// 10 | [AttributeUsage(AttributeTargets.Class)] 11 | public class MartenDocumentAttribute: MartenAttribute 12 | { 13 | public override void Register(Type discoveredType, StoreOptions options) 14 | { 15 | options.RegisterDocumentType(discoveredType); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Schema/MultiTenantedAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using Marten.Storage; 4 | 5 | namespace Marten.Schema; 6 | 7 | /// 8 | /// Directs Marten to store this document type with conjoined multi-tenancy 9 | /// 10 | [AttributeUsage(AttributeTargets.Class)] 11 | public class MultiTenantedAttribute: MartenAttribute 12 | { 13 | public override void Modify(DocumentMapping mapping) 14 | { 15 | mapping.TenancyStyle = TenancyStyle.Conjoined; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Schema/PropertySearching.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Schema; 3 | 4 | public enum PropertySearching 5 | { 6 | /// 7 | /// Uses Postgresql's JSON locators to search within JSON data 8 | /// 9 | JSON_Locator_Only, 10 | 11 | /// 12 | /// Tries to use Postgresql's @> containment operator to search within JSON data 13 | /// 14 | ContainmentOperator 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Schema/PropertySearchingAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Customize the PropertySearching mode of a single document type 8 | /// 9 | [AttributeUsage(AttributeTargets.Class)] 10 | public class PropertySearchingAttribute: MartenAttribute 11 | { 12 | private readonly PropertySearching _searching; 13 | 14 | public PropertySearchingAttribute(PropertySearching searching) 15 | { 16 | _searching = searching; 17 | } 18 | 19 | public override void Modify(DocumentMapping mapping) 20 | { 21 | mapping.PropertySearching = _searching; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_grams_query.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_grams_query(text, use_unaccent boolean DEFAULT false) 3 | RETURNS tsquery 4 | LANGUAGE plpgsql 5 | IMMUTABLE STRICT 6 | AS $function$ 7 | BEGIN 8 | RETURN (SELECT array_to_string({databaseSchema}.mt_grams_array($1, use_unaccent), ' & ') ::tsquery); 9 | END 10 | $function$; 11 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_grams_vector.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_grams_vector(text, use_unaccent boolean DEFAULT false) 3 | RETURNS tsvector 4 | LANGUAGE plpgsql 5 | IMMUTABLE STRICT 6 | AS $function$ 7 | BEGIN 8 | RETURN (SELECT array_to_string({databaseSchema}.mt_grams_array($1, use_unaccent), ' ') ::tsvector); 9 | END 10 | $function$; 11 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_immutable_date.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_immutable_date(value text) RETURNS date LANGUAGE sql IMMUTABLE AS 3 | $function$ 4 | select value::date 5 | 6 | $function$; 7 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_immutable_time.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_immutable_time(value text) RETURNS time without time zone LANGUAGE sql IMMUTABLE AS 3 | $function$ 4 | select value::time 5 | 6 | $function$; 7 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_immutable_timestamp.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_immutable_timestamp(value text) RETURNS timestamp without time zone LANGUAGE sql IMMUTABLE AS 3 | $function$ 4 | select value::timestamp 5 | 6 | $function$; 7 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_immutable_timestamptz.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_immutable_timestamptz(value text) RETURNS timestamp with time zone LANGUAGE sql IMMUTABLE AS 3 | $function$ 4 | select value::timestamptz 5 | 6 | $function$; 7 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_jsonb_copy.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION {databaseSchema}.mt_jsonb_copy(jsonb, text[], text[]) 2 | RETURNS jsonb 3 | LANGUAGE plpgsql 4 | AS $function$ 5 | DECLARE 6 | retval ALIAS FOR $1; 7 | src_path ALIAS FOR $2; 8 | dst_path ALIAS FOR $3; 9 | tmp_value jsonb; 10 | BEGIN 11 | tmp_value = retval #> src_path; 12 | retval = {databaseSchema}.mt_jsonb_fix_null_parent(retval, dst_path); 13 | RETURN jsonb_set(retval, dst_path, tmp_value::jsonb, TRUE); 14 | END; 15 | $function$; 16 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_jsonb_duplicate.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION {databaseSchema}.mt_jsonb_duplicate(jsonb, text[], jsonb) 2 | RETURNS jsonb 3 | LANGUAGE plpgsql 4 | AS $function$ 5 | DECLARE 6 | retval ALIAS FOR $1; 7 | location ALIAS FOR $2; 8 | targets ALIAS FOR $3; 9 | tmp_value jsonb; 10 | target_path text[]; 11 | target text; 12 | BEGIN 13 | FOR target IN SELECT jsonb_array_elements_text(targets) 14 | LOOP 15 | target_path = {databaseSchema}.mt_jsonb_path_to_array(target, '\.'); 16 | retval = {databaseSchema}.mt_jsonb_copy(retval, location, target_path); 17 | END LOOP; 18 | 19 | RETURN retval; 20 | END; 21 | $function$; 22 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_jsonb_increment.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION {databaseSchema}.mt_jsonb_increment(jsonb, text[], numeric) 2 | RETURNS jsonb 3 | LANGUAGE plpgsql 4 | AS $function$ 5 | DECLARE 6 | retval ALIAS FOR $1; 7 | location ALIAS FOR $2; 8 | increment_value ALIAS FOR $3; 9 | tmp_value jsonb; 10 | BEGIN 11 | tmp_value = retval #> location; 12 | IF tmp_value IS NULL THEN 13 | tmp_value = to_jsonb(0); 14 | END IF; 15 | 16 | RETURN jsonb_set(retval, location, to_jsonb(tmp_value::numeric + increment_value), TRUE); 17 | END; 18 | $function$; 19 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_jsonb_move.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION {databaseSchema}.mt_jsonb_move(jsonb, text[], text) 2 | RETURNS jsonb 3 | LANGUAGE plpgsql 4 | AS $function$ 5 | DECLARE 6 | retval ALIAS FOR $1; 7 | src_path ALIAS FOR $2; 8 | dst_name ALIAS FOR $3; 9 | dst_path text[]; 10 | tmp_value jsonb; 11 | BEGIN 12 | tmp_value = retval #> src_path; 13 | retval = retval #- src_path; 14 | dst_path = src_path; 15 | dst_path[array_length(dst_path, 1)] = dst_name; 16 | retval = {databaseSchema}.mt_jsonb_fix_null_parent(retval, dst_path); 17 | RETURN jsonb_set(retval, dst_path, tmp_value, TRUE); 18 | END; 19 | $function$; 20 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_jsonb_path_to_array.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION {databaseSchema}.mt_jsonb_path_to_array(text, character) 2 | RETURNS text[] 3 | LANGUAGE plpgsql 4 | AS $function$ 5 | DECLARE 6 | location ALIAS FOR $1; 7 | regex_pattern ALIAS FOR $2; 8 | BEGIN 9 | RETURN regexp_split_to_array(location, regex_pattern)::text[]; 10 | END; 11 | $function$; 12 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_mark_event_progression.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_mark_event_progression(name varchar, last_encountered bigint) RETURNS VOID LANGUAGE plpgsql AS 3 | $function$ 4 | BEGIN 5 | INSERT INTO {databaseSchema}.mt_event_progression (name, last_seq_id, last_updated) 6 | VALUES (name, last_encountered, transaction_timestamp()) 7 | ON CONFLICT ON CONSTRAINT pk_mt_event_progression 8 | DO 9 | UPDATE SET last_seq_id = last_encountered, last_updated = transaction_timestamp(); 10 | 11 | END; 12 | 13 | $function$; 14 | -------------------------------------------------------------------------------- /src/Marten/Schema/SQL/mt_safe_unaccent.sql: -------------------------------------------------------------------------------- 1 | CREATE 2 | OR REPLACE FUNCTION {databaseSchema}.mt_safe_unaccent(use_unaccent BOOLEAN, word TEXT) 3 | RETURNS TEXT 4 | LANGUAGE plpgsql 5 | IMMUTABLE STRICT 6 | AS $function$ 7 | BEGIN 8 | IF use_unaccent THEN 9 | RETURN unaccent(word); 10 | ELSE 11 | RETURN word; 12 | END IF; 13 | END; 14 | $function$; 15 | -------------------------------------------------------------------------------- /src/Marten/Schema/StructuralTypedAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Allows you to duplicate storage with other classes of the same name 8 | /// 9 | [AttributeUsage(AttributeTargets.Class)] 10 | public class StructuralTypedAttribute: MartenAttribute 11 | { 12 | public override void Modify(DocumentMapping mapping) 13 | { 14 | mapping.StructuralTyped = true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Schema/UniqueIndexType.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Schema; 3 | 4 | public enum UniqueIndexType 5 | { 6 | /// 7 | /// Create a duplicated field for this unique index 8 | /// 9 | DuplicatedField, 10 | 11 | /// 12 | /// Use a computed expression without duplicating the field for this unique index 13 | /// 14 | Computed 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Schema/UseOptimisticConcurrencyAttribute.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | 4 | namespace Marten.Schema; 5 | 6 | /// 7 | /// Directs Marten to use optimistic versioning checks when updating this document type 8 | /// 9 | [AttributeUsage(AttributeTargets.Class)] 10 | public class UseOptimisticConcurrencyAttribute: MartenDocumentAttribute 11 | { 12 | public override void Modify(DocumentMapping mapping) 13 | { 14 | mapping.UseOptimisticConcurrency = true; 15 | mapping.Metadata.Version.Enabled = true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Services/BatchQuerying/IBatchQueryItem.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Data.Common; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Marten.Internal; 6 | using Marten.Linq.QueryHandlers; 7 | 8 | namespace Marten.Services.BatchQuerying; 9 | 10 | internal interface IBatchQueryItem 11 | { 12 | IQueryHandler Handler { get; } 13 | 14 | Task ReadAsync(DbDataReader reader, IMartenSession session, CancellationToken token); 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Services/BatchQuerying/IBatchedOrderedQueryable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace Marten.Services.BatchQuerying; 5 | 6 | public interface IBatchedOrderedQueryable: IBatchedQueryable 7 | { 8 | IBatchedOrderedQueryable ThenBy(Expression> expression); 9 | 10 | IBatchedOrderedQueryable ThenByDescending(Expression> expression); 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Services/CommandRunnerMode.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Services; 2 | 3 | public enum CommandRunnerMode 4 | { 5 | /// 6 | /// Marten controls the transactional boundary 7 | /// 8 | Transactional, 9 | ReadOnly, 10 | 11 | /// 12 | /// Implies that some other process is controlling the transaction boundaries 13 | /// 14 | External 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Services/IChangeSet.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using JasperFx.Events; 4 | using Marten.Events; 5 | 6 | namespace Marten.Services; 7 | 8 | public interface IChangeSet 9 | { 10 | IEnumerable Updated { get; } 11 | IEnumerable Inserted { get; } 12 | IEnumerable Deleted { get; } 13 | 14 | IEnumerable GetEvents(); 15 | 16 | IEnumerable GetStreams(); 17 | 18 | IChangeSet Clone(); 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/Services/IDeletion.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Marten.Internal.Operations; 3 | 4 | namespace Marten.Services; 5 | 6 | public interface IDeletion: IStorageOperation, NoDataReturnedCall 7 | { 8 | object Document { get; set; } 9 | object Id { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /src/Marten/Services/ISingleQueryHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Npgsql; 5 | 6 | namespace Marten.Services; 7 | 8 | public interface ISingleQueryHandler 9 | { 10 | NpgsqlCommand BuildCommand(); 11 | Task HandleAsync(DbDataReader reader, CancellationToken token); 12 | } 13 | -------------------------------------------------------------------------------- /src/Marten/Services/ISingleQueryRunner.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace Marten.Services; 6 | 7 | internal interface ISingleQueryRunner 8 | { 9 | Task Query(ISingleQueryHandler handler, CancellationToken cancellation); 10 | Task SingleCommit(DbCommand command, CancellationToken cancellation); 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Services/Json/SerializerOptions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Weasel.Core; 3 | 4 | namespace Marten.Services.Json; 5 | 6 | public class SerializerOptions 7 | { 8 | public EnumStorage EnumStorage { get; set; } = EnumStorage.AsInteger; 9 | 10 | public Casing Casing { get; set; } = Casing.Default; 11 | 12 | public CollectionStorage CollectionStorage { get; set; } = CollectionStorage.Default; 13 | 14 | public NonPublicMembersStorage NonPublicMembersStorage { get; set; } = NonPublicMembersStorage.Default; 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Services/Json/SerializerType.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace Marten.Services.Json; 3 | 4 | public enum SerializerType 5 | { 6 | Newtonsoft, 7 | SystemTextJson 8 | } 9 | -------------------------------------------------------------------------------- /src/Marten/Services/NoDataReturnedCall.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Services; 2 | 3 | /// 4 | /// Marker interface telling Marten not 5 | /// to advance the results for callbacks 6 | /// 7 | public interface NoDataReturnedCall 8 | { 9 | } 10 | 11 | public interface AssertsOnCallback{} 12 | -------------------------------------------------------------------------------- /src/Marten/Sessions/DirtyTrackedSessionFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Sessions; 2 | 3 | internal class DirtyTrackedSessionFactory: ISessionFactory 4 | { 5 | private readonly IDocumentStore _store; 6 | 7 | public DirtyTrackedSessionFactory(IDocumentStore store) => 8 | _store = store; 9 | 10 | public IQuerySession QuerySession() => 11 | _store.QuerySession(); 12 | 13 | public IDocumentSession OpenSession() => 14 | _store.DirtyTrackedSession(); 15 | } 16 | -------------------------------------------------------------------------------- /src/Marten/Sessions/IdentitySessionFactory.cs: -------------------------------------------------------------------------------- 1 | using Marten.Services; 2 | 3 | namespace Marten.Sessions; 4 | 5 | internal class IdentitySessionFactory: SessionFactoryBase 6 | { 7 | public IdentitySessionFactory(IDocumentStore store) : base(store){} 8 | 9 | public override SessionOptions BuildOptions() 10 | { 11 | return new SessionOptions { Tracking = DocumentTracking.IdentityOnly }; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Sessions/LightweightSessionFactory.cs: -------------------------------------------------------------------------------- 1 | using Marten.Services; 2 | 3 | namespace Marten.Sessions; 4 | 5 | internal class LightweightSessionFactory: SessionFactoryBase 6 | { 7 | public LightweightSessionFactory(IDocumentStore store) : base(store){} 8 | 9 | public override SessionOptions BuildOptions() 10 | { 11 | return new SessionOptions { Tracking = DocumentTracking.None }; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Marten/Storage/ISelectableColumn.cs: -------------------------------------------------------------------------------- 1 | using JasperFx.CodeGeneration; 2 | using Marten.Internal.CodeGeneration; 3 | using Marten.Schema; 4 | 5 | namespace Marten.Storage; 6 | 7 | internal interface ISelectableColumn 8 | { 9 | string Name { get; } 10 | 11 | void GenerateCode(StorageStyle storageStyle, GeneratedType generatedType, GeneratedMethod async, 12 | GeneratedMethod sync, int index, 13 | DocumentMapping mapping); 14 | 15 | bool ShouldSelect(DocumentMapping mapping, StorageStyle storageStyle); 16 | } 17 | -------------------------------------------------------------------------------- /src/Marten/Storage/MasterTableTenancyOptions.cs: -------------------------------------------------------------------------------- 1 | using Npgsql; 2 | using Weasel.Core.MultiTenancy; 3 | using Weasel.Postgresql; 4 | 5 | namespace Marten.Storage; 6 | 7 | public class MasterTableTenancyOptions: MasterTableTenancyOptions 8 | { 9 | public MasterTableTenancyOptions(): base(PostgresqlProvider.Instance) 10 | { 11 | } 12 | 13 | public void RegisterDatabase(string tenantId, string connectionString) 14 | { 15 | SeedDatabases.Register(tenantId, connectionString); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Marten/Storage/OriginWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Weasel.Postgresql.Tables; 3 | 4 | namespace Marten.Storage; 5 | 6 | internal static class OriginWriter 7 | { 8 | private static readonly string MartenFqn = typeof(IDocumentStore).AssemblyQualifiedName; 9 | 10 | public static string OriginStatement(string objectType, string objectName) 11 | { 12 | return $"COMMENT ON {objectType} {objectName} IS 'origin:{MartenFqn}';"; 13 | } 14 | 15 | public static string OriginStatement(this Table definition) 16 | { 17 | return OriginStatement("TABLE", definition.Identifier.QualifiedName); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Marten/Storage/Tenancy.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Storage; 2 | 3 | public abstract class Tenancy 4 | { 5 | protected Tenancy(StoreOptions options) 6 | { 7 | Options = options; 8 | } 9 | 10 | internal StoreOptions Options { get; } 11 | } 12 | -------------------------------------------------------------------------------- /src/Marten/Storage/TenancyStyle.cs: -------------------------------------------------------------------------------- 1 | namespace Marten.Storage; 2 | 3 | public enum TenancyStyle 4 | { 5 | /// 6 | /// No multi-tenancy, the default mode 7 | /// 8 | Single, 9 | 10 | /// 11 | /// Multi-tenanted within the same database/schema through a tenant id 12 | /// 13 | Conjoined 14 | } 15 | -------------------------------------------------------------------------------- /src/Marten/Util/ReflectionExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq; 3 | using System.Reflection; 4 | using JasperFx.Core; 5 | 6 | namespace Marten.Util; 7 | 8 | internal static class ReflectionExtensions 9 | { 10 | public static string ToTableAlias(this MemberInfo[] members) 11 | { 12 | return members.Select(x => x.ToTableAlias()).Join("_"); 13 | } 14 | 15 | public static string ToTableAlias(this MemberInfo member) 16 | { 17 | return member.Name.ToTableAlias(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MartenBenchmarks/BenchAgainst/BenchModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MartenBenchmarks.BenchAgainst; 4 | 5 | public sealed class BenchModel 6 | { 7 | public BenchModel() 8 | { 9 | Id = Guid.NewGuid(); 10 | } 11 | 12 | public Guid Id { get; set; } 13 | } -------------------------------------------------------------------------------- /src/MartenBenchmarks/BenchAgainst/BenchModel2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MartenBenchmarks.BenchAgainst; 4 | 5 | public sealed class BenchModel2 6 | { 7 | public BenchModel2() 8 | { 9 | Id = Guid.NewGuid(); 10 | } 11 | 12 | public Guid Id { get; set; } 13 | } -------------------------------------------------------------------------------- /src/MartenBenchmarks/BenchAgainst/BenchModel3.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MartenBenchmarks.BenchAgainst; 4 | 5 | public sealed class BenchModel3 6 | { 7 | public BenchModel3() 8 | { 9 | Id = Guid.NewGuid(); 10 | } 11 | 12 | public Guid Id { get; set; } 13 | } -------------------------------------------------------------------------------- /src/MartenBenchmarks/BenchAgainst/BenchModel4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MartenBenchmarks.BenchAgainst; 4 | 5 | public sealed class BenchModel4 6 | { 7 | public BenchModel4() 8 | { 9 | Id = Random.Shared.Next(int.MaxValue); 10 | } 11 | 12 | public int Id { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /src/MartenBenchmarks/Infrastructure/StringToTextReaderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | 4 | namespace MartenBenchmarks.Infrastructure; 5 | 6 | public static class StringToTextReaderExtensions 7 | { 8 | public static TextReader ToReader(this string json) 9 | { 10 | return new StringReader(json); 11 | } 12 | } 13 | 14 | public static class StringToStreamExtensions 15 | { 16 | public static Stream ToReader(this string json) 17 | { 18 | return new MemoryStream(Encoding.UTF8.GetBytes(json)); 19 | } 20 | } -------------------------------------------------------------------------------- /src/MemoryUsageChecker/MemoryUsageChecker.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/MultiHostTests/00_init.sql: -------------------------------------------------------------------------------- 1 | CREATE USER replicator WITH REPLICATION ENCRYPTED PASSWORD 'replicator_password'; 2 | SELECT pg_create_physical_replication_slot('replication_slot'); -------------------------------------------------------------------------------- /src/MultiTenancyTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] 3 | -------------------------------------------------------------------------------- /src/MultiTenancyTests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Xunit; 2 | -------------------------------------------------------------------------------- /src/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /src/TestSetup.cs: -------------------------------------------------------------------------------- 1 | using Marten.Services.Json; 2 | using Marten.Testing.Harness; 3 | using Xunit; 4 | using Xunit.Abstractions; 5 | using Xunit.Sdk; 6 | 7 | [assembly: TestFramework("ConfigurationTests.TestSetup", "ConfigurationTests")] 8 | 9 | namespace ConfigurationTests 10 | { 11 | public class TestSetup : XunitTestFramework 12 | { 13 | public TestSetup(IMessageSink messageSink) 14 | :base(messageSink) 15 | { 16 | SerializerFactory.DefaultSerializerType = TestsSettings.SerializerType; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ValueTypeTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /src/ValueTypeTests/notes.md: -------------------------------------------------------------------------------- 1 | # Notes 2 | 3 | ## Test Cases 4 | 5 | * Basic operations with ints 6 | * Basic operations with longs 7 | * Basic operations with strings 8 | * Validate that the id passed into LoadAsync/LoadManyAsync(id) is the right type for the document 9 | * LINQ Where(x => x.Id == value) 10 | * LINQ Where(x => x.Id.IsOneOf(values)) 11 | * LINQ Where(x => x.Id > value) 12 | * LINQ OrderBy() 13 | * Include() with any 14 | * Verify the JSON 15 | * Bulk inserts, both with and without id assignments already there 16 | -------------------------------------------------------------------------------- /src/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | services: 4 | aspnetodatawithmarten: 5 | build: 6 | context: . 7 | dockerfile: AspNetODataWithMarten/Dockerfile 8 | ports: 9 | - "8080:8080" 10 | environment: 11 | ASPNETCORE_ENVIRONMENT: "Development" 12 | ASPNETCORE_HTTP_PORTS: 8080 13 | POSTGRES_CONNECTION_STRING: "Host=postgres;Port=5432;Database=weatherforecast;Username=postgres;password=Password123!" 14 | depends_on: 15 | - postgres 16 | 17 | postgres: 18 | image: postgres 19 | environment: 20 | POSTGRES_DB: "weatherforecast" 21 | POSTGRES_PASSWORD: "Password123!" 22 | ports: 23 | - "5432:5432" 24 | -------------------------------------------------------------------------------- /src/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Docker Compose": { 4 | "commandName": "DockerCompose", 5 | "commandVersion": "1.0", 6 | "serviceActions": { 7 | "aspnetodatawithmarten": "StartDebugging" 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/samples/AspireHost/Program.cs: -------------------------------------------------------------------------------- 1 | var builder = DistributedApplication.CreateBuilder(args); 2 | 3 | builder.AddProject("publisher"); 4 | builder.AddProject("runner"); 5 | 6 | builder.Build().Run(); 7 | -------------------------------------------------------------------------------- /src/samples/AspireHost/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/samples/AspireHost/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning", 6 | "Aspire.Hosting.Dcp": "Warning" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/samples/DocSamples/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Xunit; 2 | -------------------------------------------------------------------------------- /src/samples/EventSourcingIntro/EventSourcingIntro.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net9.0 6 | enable 7 | latest 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithAcknowledgedIncident.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Helpdesk.Api.Incidents.GetIncidentDetails; 3 | using Ogooreck.API; 4 | using Xunit; 5 | 6 | namespace Helpdesk.Api.Tests.Incidents.Fixtures; 7 | 8 | public class ApiWithAcknowledgedIncident: ApiSpecification, IAsyncLifetime 9 | { 10 | public async Task InitializeAsync() 11 | { 12 | Incident = await this.AcknowledgedIncident(); 13 | } 14 | 15 | public IncidentDetails Incident { get; set; } = default!; 16 | 17 | public Task DisposeAsync() => Task.CompletedTask; 18 | } 19 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithLoggedIncident.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Helpdesk.Api.Incidents.GetIncidentDetails; 3 | using Ogooreck.API; 4 | using Xunit; 5 | 6 | namespace Helpdesk.Api.Tests.Incidents.Fixtures; 7 | 8 | public class ApiWithLoggedIncident: ApiSpecification, IAsyncLifetime 9 | { 10 | public async Task InitializeAsync() 11 | { 12 | Incident = await this.LoggedIncident(); 13 | } 14 | 15 | public IncidentDetails Incident { get; protected set; } = default!; 16 | public Task DisposeAsync() => Task.CompletedTask; 17 | } 18 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api.Tests/Incidents/Fixtures/ApiWithResolvedIncident.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Helpdesk.Api.Incidents.GetIncidentDetails; 3 | using Ogooreck.API; 4 | using Xunit; 5 | 6 | namespace Helpdesk.Api.Tests.Incidents.Fixtures; 7 | 8 | public class ApiWithResolvedIncident: ApiSpecification, IAsyncLifetime 9 | { 10 | public async Task InitializeAsync() 11 | { 12 | Incident = await this.ResolvedIncident(); 13 | } 14 | 15 | public IncidentDetails Incident { get; set; } = default!; 16 | 17 | public Task DisposeAsync() => Task.CompletedTask; 18 | } 19 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api.Tests/Settings.cs: -------------------------------------------------------------------------------- 1 | using Oakton; 2 | using Xunit; 3 | using Xunit.Abstractions; 4 | using Xunit.Sdk; 5 | 6 | [assembly: CollectionBehavior(DisableTestParallelization = true)] 7 | 8 | [assembly: TestFramework("Helpdesk.Api.Tests.AssemblyFixture", "Helpdesk.Api.Tests")] 9 | 10 | namespace Helpdesk.Api.Tests; 11 | 12 | public sealed class AssemblyFixture : XunitTestFramework 13 | { 14 | public AssemblyFixture(IMessageSink messageSink) 15 | :base(messageSink) 16 | { 17 | OaktonEnvironment.AutoStartHost = true; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api/.dockerignore: -------------------------------------------------------------------------------- 1 | **/bin/ 2 | **/obj/ 3 | **/out/ 4 | **/TestResults/ 5 | **/Internal/Generated 6 | Dockerfile 7 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Helpdesk.Api": { 4 | "commandName": "Project", 5 | "dotnetRunMessages": true, 6 | "launchBrowser": true, 7 | "launchUrl": "swagger/index.html", 8 | "applicationUrl": "http://localhost:5248", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api/appsettings.Production.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | "ConnectionStrings": { 10 | "Incidents": "Host=localhost;Port=5432;Database=marten_testing;Username=postgres;password=postgres;Command Timeout=5" 11 | }, 12 | "KafkaProducer": { 13 | "ProducerConfig": { 14 | "BootstrapServers": "kafka:9092" 15 | }, 16 | "Topic": "Incidents" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/samples/Helpdesk/Helpdesk.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | "ConnectionStrings": { 10 | "Incidents": "Host=localhost;Port=5432;Database=marten_testing;Username=postgres;password=postgres;Command Timeout=5" 11 | }, 12 | "KafkaProducer": { 13 | "ProducerConfig": { 14 | "BootstrapServers": "localhost:9092" 15 | }, 16 | "Topic": "Incidents" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/samples/MinimalAPI/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/samples/MinimalAPI/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /test/mocha.opts: -------------------------------------------------------------------------------- 1 | --recursive 2 | --reporter spec 3 | --bail 4 | --------------------------------------------------------------------------------