【发布时间】:2021-08-31 05:20:50
【问题描述】:
我试图在 C# 中生成 3000 条假记录,条件是每 1000 条项目在 UTC 毫秒内具有相同的时间戳(update_time),然后接下来的 1000 条将在 UTC 毫秒内具有相同的时间戳。如何实现?
private static IReadOnlyCollection<Document> GetDocumentsToInsert()
{
return new Bogus.Faker<Document>()
.StrictMode(true)
//Generate item
.RuleFor(o => o.id, f => Guid.NewGuid().ToString()) //id
.RuleFor(o => o.update_time, f => DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();)
.Generate(3000);
}
// <Model>
public class Document
{
public string update_time {get;set;}
public string id{get;set;}
}
【问题讨论】: