/// <summary> /// Maps relations for an IRelatableEntity and all entities attached to those relations to index operations /// </summary> /// <param name="entity"></param> /// <param name="operation"></param> /// <param name="engine"></param> internal static void MapRelations <T>(this T entity, NestedHiveIndexOperation operation, AbstractFluentMappingEngine engine) where T : IRelatableEntity { //get the relations foreach (var r in entity.RelationProxies.AllChildRelations().Union(entity.RelationProxies.AllParentRelations())) { var relation = engine.Map <IReadonlyRelation <IRelatableEntity, IRelatableEntity>, NestedHiveIndexOperation>(r.Item); //we need to process the entities attached to the relation and add them to the sub index ops: if (entity.Id != r.Item.SourceId) { if (r.Item.Source != null) { operation.SubIndexOperations.Add(engine.Map <NestedHiveIndexOperation>(r.Item.Source)); } } if (entity.Id != r.Item.DestinationId) { if (r.Item.Destination != null) { operation.SubIndexOperations.Add(engine.Map <NestedHiveIndexOperation>(r.Item.Destination)); } } //now, we need to add the relation itself to the sub index ops: operation.SubIndexOperations.Add(relation); } }
private void VerifyIEntityFields(NestedHiveIndexOperation result, IEntity entity) { Assert.AreEqual(entity.UtcCreated.UtcDateTime, result.Fields["UtcCreated"].FieldValue); Assert.AreEqual(entity.UtcStatusChanged.UtcDateTime, result.Fields["UtcStatusChanged"].FieldValue); }