Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Options property to IDocumentStore interface #1230

Closed
mdissel opened this issue Mar 20, 2019 · 6 comments
Closed

Add Options property to IDocumentStore interface #1230

mdissel opened this issue Mar 20, 2019 · 6 comments
Milestone

Comments

@mdissel
Copy link
Contributor

mdissel commented Mar 20, 2019

Options is a required part of the DocumentStore, so i think we should add this to the IDocumentStore interface (in the next major version of course)

StoreOptions Options { get; }

@mysticmind mysticmind added this to the 4.0 milestone Mar 24, 2019
@jeremydmiller
Copy link
Member

My vote is "no". If you dig back long enough there's an issue about only exposing a read only interface of StoreOptions, because users can actually modify the StoreOptions object after the DocumentStore is initialized, but most of that wouldn't actually take effect. I think this is just opening up users for confusion.

@mdissel
Copy link
Contributor Author

mdissel commented Apr 3, 2019

Ok, the reason for my question is that inside a sessionlistener I have this code:

if ((session.DocumentStore as Marten.DocumentStore)?.Options.Storage.MappingFor(entity.GetType()).DeleteStyle == m.Schema.DeleteStyle.SoftDelete) { // skip auditing return; }

I need the storage definition via the IDocumentStore. Any alternative?

@oskardudycz
Copy link
Collaborator

oskardudycz commented Apr 3, 2019

@jeremydmiller maybe we could just add it as readonly? In thery we could only return some limited interface with readonly members?

@mysticmind
Copy link
Member

Check #745 which was closed with a code comment to expose StoreOptions as readonly

@jeremydmiller
Copy link
Member

Still saying to only do this if we pull out a readonly interface. Not sure how much value it adds or what you'd use it for. Most of it shouldn't be altered at runtime. You can get at the connections & serializer in other ways.

What @mdissel asked for would require a new read only interface for IDocumentMapping. And what he's after could technically be done differently if we'd just add something to IDeletion to let you know if it's a hard or soft delete.

@oskardudycz
Copy link
Collaborator

I think that it's worth adding a read-only interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants