private DSPResource CreateDSPResource <TSource>(TSource document, string resourceName) { var typedDocument = document.ToBsonDocument(); var resource = MongoDSPConverter.CreateDSPResource(typedDocument, this.mongoMetadata, resourceName); if (this.mongoMetadata.Configuration.UpdateDynamically) { UpdateMetadataFromResourceSet(resourceName, typedDocument); } return(resource); }
private void PopulateData(DSPInMemoryContext dspContext, MongoContext mongoContext, DSPMetadata metadata) { foreach (var resourceSet in metadata.ResourceSets) { var storage = dspContext.GetResourceSetStorage(resourceSet.Name); var collection = mongoContext.Database.GetCollection(resourceSet.Name); foreach (var document in collection.FindAll()) { var resource = MongoDSPConverter.CreateDSPResource(document, metadata, resourceSet.Name); storage.Add(resource); } } }
private void PopulateData(DSPInMemoryContext dspContext, MongoContext mongoContext) { foreach (var resourceSet in this.Metadata.ResourceSets) { var storage = dspContext.GetResourceSetStorage(resourceSet.Name); var collection = mongoContext.Database.GetCollection(resourceSet.Name); foreach (var document in collection.FindAll()) { var resource = MongoDSPConverter.CreateDSPResource(document, this.mongoMetadata, resourceSet.Name); storage.Add(resource); if (this.mongoMetadata.Configuration.UpdateDynamically) { UpdateMetadataFromResourceSet(mongoContext, resourceSet, document); } } } }