Я использую пакет Audit.Net для аудита требований к моему приложению. https://github.com/thepirat000/Audit.NET/tree/master/src/Audit.NET.MongoDB#auditnetmongodb
Я сталкиваюсь с исключением сериализации JSON, когда пытаюсь использовать метод AuditScope.Create. Прилагается исключение, которое я получаю. Что мне не хватает?
Ниже представлен класс UserProfiles:
public class UserProfiles
{
[BsonId]
public ObjectId Id { get; set; }
public int UserId { get; set; }
[BsonRequired]
public string UserName { get; set; }
[BsonRequired]
public string Password { get; set; }
public string Role { get; set; }
[BsonRequired]
public string Email { get; set; }
[BsonRequired]
public string ProjectId { get; set; }
}
Файл Startup.cs: ниже используется код:
public Startup(IConfiguration configuration)
{
Configuration = configuration;
Audit.Core.Configuration.DataProvider = new Audit.MongoDB.Providers.MongoDataProvider()
{
ConnectionString = "mongodb://localhost:27017",
Database = "Audit",
Collection = "Event"
};
}
Я также попытался перенести конфигурацию поставщика данных в метод ConfigureServices. Я получаю ту же ошибку. Что-то я пропустил?
Спасибо, Вани
UserProfiles
? Вы объявляете какую-либо собственность какObjectId
? - person thepirat000   schedule 30.04.2020JsonConverter
и переопределение свойстваMongoDataProvider.JsonSerializerSettings
) - person thepirat000   schedule 30.04.2020UserProfiles
имеет свойствоObjectId
. - person Vani Kulkarni   schedule 01.05.2020