Mongo 的 OData:System.ArgumentException:'类型 'Item' 上的 属性 'Id' 必须是复杂的 属性。 (参数'propertyInfo')'

OData with Mongo: System.ArgumentException: 'The property 'Id' on type 'Item' must be a Complex property. (Parameter 'propertyInfo')'

我正在尝试使用 ODataMongo 配置 .net core

我收到此错误:System.ArgumentException: 'The property 'Id' on type 'Item' must be a Complex property. (Parameter 'propertyInfo')'

这是我的配置:

services.AddControllers(options =>
            {
               // something here
            })
            .AddOData(opt =>
            {
                opt.Count()
                    .Filter()
                    .Expand()
                    .Select()
                    .OrderBy()
                    .SetMaxTop(5000)
                    .AddRouteComponents("odata", GetEdmModel());

                opt.TimeZone = TimeZoneInfo.Utc;
            });

public static IEdmModel GetEdmModel()
    {
        var builder = new ODataConventionModelBuilder();

        var entitySetConfiguration = builder.EntitySet<Item>("Item");
        entitySetConfiguration.EntityType.HasKey(entity => entity.Id);

        return builder.GetEdmModel();
    }

我的实体:

public class Item : Document
{
    public string SubCategory { get; set; }
    public string ProductCode { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
}

public abstract class Document : IDocument
{
    public ObjectId Id { get; set; }

    public DateTime CreatedAt => Id.CreationTime;
}
public abstract class Document : IDocument
{
    //...
    public string IdStr => Id.ToString();
}