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

New "Policy" model to apply conventions to document mapping #751

Closed
jeremydmiller opened this issue May 6, 2017 · 1 comment
Closed
Milestone

Comments

@jeremydmiller
Copy link
Member

More details necessary, but I'm basing the idea on some of my previous work w/ FubuMVC or StructureMap.

Something like:

StoreOptions.Policies.OnDocuments<T>() where T : IDocumentPolicy
StoreOptions.Policies.OnDocuments(IDocumentPolicy policy)
StoreOptions.Policies.OnFields<T>() where T : ILocatorPolicy
StoreOptions.Policies.OnFields(ILocatorPolicy policy)

public interface IDocumentPolicy
{
    // Optionally alter how the document type is stored
    void Apply(DocumentMapping mapping);


}

// Each registered policy would get applied to JsonLocatorField's within the DocumentMapping
public interface ILocatorPolicy
{
    // Optionally alter JsonLocatorField's. Thinking this would be valuable for
    // some of the F# specific mapping we're already running into.
    void Apply(JsonLocatorField);
}
@jeremydmiller
Copy link
Member Author

Verified that either attributes on the document or explicit Fluent Interface configuration overrides the policies

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

1 participant