Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Feature/collection mapping #97

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

roberino
Copy link

As per the issue I raised:

#83

I've created fluent mapping methods which allow the consumer to map entities through an interface rather than decoratively through attributes. This approach gives the consumer both options. With the fluent approach, entities can be agnostic of the Cosmonaut library and the mapping concerns can be decoupled.

The attribute approach is still very valid and useful for most scenarios and will continue to work as before.

Elfocrash and others added 21 commits April 25, 2018 13:09
@Elfocrash
Copy link
Owner

Elfocrash commented Jul 12, 2019

Hey @rob thanks for that. It looks really good. A few comments before I do a full review.

Can you please uncomment the commented out tests?
I also can't merge any breaking changes so I have to ask, are there any breaking changes on the API? If yes then will have to wait until v3 which will be out when the Cosmos DB SDK v3 is out and integrated with Cosmonaut.

There also seem to be some merge conflicts that need to be addressed.

@Elfocrash Elfocrash added the enhancement New feature or request label Jul 12, 2019
Copy link
Owner

@Elfocrash Elfocrash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several comments. Also you will need to pull the latest serialization work I did.

@@ -24,6 +25,8 @@ public sealed class CosmosStore<TEntity> : ICosmosStore<TEntity> where TEntity :

public ICosmonautClient CosmonautClient { get; }

internal EntityCollectionMapping EntityCollectionMapping { get; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of setting this in the ctor as the return value of InitialiseCosmosStore can we add an internal setter and set it in there? I don't like the fact that InitialiseCosmosStore doesn't imply what the method will be returning. It's an internal property anyway so it should be fine.

_databaseCreator = databaseCreator ?? new CosmosDatabaseCreator(CosmonautClient);
InitialiseCosmosStore(overriddenCollectionName);

EntityCollectionMapping = InitialiseCosmosStore(overriddenCollectionName);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned at line https://github.com/Elfocrash/Cosmonaut/pull/97/files#diff-56d4febe3cf61714e5bc8bd6579d82d8R28 can we set that in the InitialiseCosmosStore method?

@@ -38,15 +41,15 @@ public CosmosStore(CosmosStoreSettings settings, string overriddenCollectionName
var documentClient = DocumentClientFactory.CreateDocumentClient(settings);
CosmonautClient = new CosmonautClient(documentClient, Settings.InfiniteRetries);
if (string.IsNullOrEmpty(Settings.DatabaseName)) throw new ArgumentNullException(nameof(Settings.DatabaseName));
_collectionCreator = new CosmosCollectionCreator(CosmonautClient);
_collectionCreator = new CosmosCollectionCreator(CosmonautClient, settings.EntityConfigurationProvider);
_databaseCreator = new CosmosDatabaseCreator(CosmonautClient);
InitialiseCosmosStore(overriddenCollectionName);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming you also have to set the EntityCollectionMapping here as well right?

@roberino
Copy link
Author

Ok...leave this with me. When I get a mo, I'll try to sort them out. Thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants