private Task EnsureUniqueIndex(Type sagaDataType, string propertyName) { if (propertyName == null) { return(Task.FromResult(0)); } var classmap = BsonClassMap.LookupClassMap(sagaDataType); var uniqueFieldName = GetFieldName(classmap, propertyName); return(_repo.EnsureUniqueIndex(sagaDataType, uniqueFieldName)); }
private void EnsureUniqueIndex(IContainSagaData saga) { var sagaDataType = saga.GetType(); var uniqueProperty = UniqueAttribute.GetUniqueProperty(sagaDataType); if (uniqueProperty == null) { return; } var classmap = BsonClassMap.LookupClassMap(sagaDataType); var uniqueFieldName = GetFieldName(classmap, uniqueProperty.Name); _repo.EnsureUniqueIndex(sagaDataType, uniqueFieldName); }