mongodb custom IIdGenerator
public class GuidIdGenerator : IIdGenerator
{
public object GenerateId(object container, object document)
{
return Guid.NewGuid().ToString();
}
public bool IsEmpty(object id)
{
return !(id is string guid) || string.IsNullOrEmpty(guid);
}
}