Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

[Question] Is it possible to customize partition key on cosmos store? #108

Open
xaviersolau opened this issue Feb 7, 2020 · 1 comment
Assignees
Labels

Comments

@xaviersolau
Copy link

I would like to use other properties as partition key for cosmos store but it looks like it is hard coded in CosmosDomainDbContext :

builder.Entity<AggregateEntity>()
                .ToContainer(_settings.AggregateContainerName)
                .HasPartitionKey(p => p.Type)
                .HasNoDiscriminator();

builder.Entity<CommandEntity>()
                .ToContainer(_settings.CommandContainerName)
                .HasPartitionKey(p => p.Type)
                .HasNoDiscriminator();

builder.Entity<EventEntity>()
                .ToContainer(_settings.EventContainerName)
                .HasPartitionKey(p => p.Type)
                .HasNoDiscriminator();

Any idea ?
By the way why did you chose the Type as partition key? Why not the AggregateId for example?

@lucabriguglia
Copy link
Owner

You are right, the AggregateId would have been the right choice. Unfortunately it's not possible at the moment but in the mean time you can create a custom provider to address that.

@lucabriguglia lucabriguglia self-assigned this Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants