Seems like Marten7 is forcing numeric revisions on async projections by this policy (it was definitely a surprise during upgrade and should have been mentioned in the Migration Guide and not only on the concurency page)

Is there a reason why numeric is forcefully enabled in this case?
Seems like the policy should have checked if IVersioned with Guid was present on the projection type?
Perhaps there should be a way to opt out for Guid Revision?

The problem is when you try to opt out from this via explicit UseNumericRevisions(false),
options.Projections.Snapshot<SomeProjectionAggregate>(SnapshotLifecycle.Async)
.UseNumericRevisions(false);
then m.Metadata.Revision.Enabled = true is still enabled resulting in exception during schema patch generation
Unhandled exception: System.ArgumentException: An item with the same key has already been added. Key: mt_version
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey](List`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
at Weasel.Postgresql.Tables.ItemDelta`1..ctor(IEnumerable`1 expectedItems, IEnumerable`1 actualItems, Func`3 comparison)
at Weasel.Postgresql.Tables.TableDelta.compare(Table expected, Table actual)
at Weasel.Core.SchemaObjectDelta`1..ctor(T expected, T actual)
at Weasel.Postgresql.Tables.TableDelta..ctor(Table expected, Table actual)
at Weasel.Postgresql.Tables.Table.CreateDeltaAsync(DbDataReader reader, CancellationToken ct)
at Weasel.Core.SchemaMigration.DetermineAsync(DbConnection conn, CancellationToken ct, ISchemaObject[] schemaObjects)
at Weasel.Core.SchemaMigration.DetermineAsync(DbConnection conn, CancellationToken ct, ISchemaObject[] schemaObjects)
/// <summary>
/// Directs Marten to use the numeric revisioning for this specific
/// document type
/// </summary>
/// <returns></returns>
public MartenRegistry.DocumentMappingExpression<T> UseNumericRevisions(bool enabled)
{
this._builder.Alter = (Action<DocumentMapping<T>>) (m =>
{
m.UseNumericRevisions = enabled;
if (!enabled) // the method will return here
return;
m.Metadata.Revision.Enabled = true; // this revision would be kept enabled.
});
return this;
}
IMO we need to either disable as well via m.Metadata.Revision.Enabled = enabled inside UseNumericRevisions(false) or provide an alternative extension method to do switch to Guid based revisions
Seems like Marten7 is forcing numeric revisions on async projections by this policy (it was definitely a surprise during upgrade and should have been mentioned in the Migration Guide and not only on the concurency page)

Is there a reason why numeric is forcefully enabled in this case?
Seems like the policy should have checked if IVersioned with Guid was present on the projection type?
Perhaps there should be a way to opt out for Guid Revision?
The problem is when you try to opt out from this via explicit UseNumericRevisions(false),
then m.Metadata.Revision.Enabled = true is still enabled resulting in exception during schema patch generation
IMO we need to either disable as well via
m.Metadata.Revision.Enabled = enabledinside UseNumericRevisions(false) or provide an alternative extension method to do switch to Guid based revisions