I am using Audit.Net package for auditing requirements for my application. https://github.com/thepirat000/Audit.NET/tree/master/src/Audit.NET.MongoDB#auditnetmongodb
I am facing JSON Serialization exception, when I try to use the AuditScope.Create method. Attached is the exception I get. What am I missing?
Below is the class 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 file: below is code used:
public Startup(IConfiguration configuration)
{
Configuration = configuration;
Audit.Core.Configuration.DataProvider = new Audit.MongoDB.Providers.MongoDataProvider()
{
ConnectionString = "mongodb://localhost:27017",
Database = "Audit",
Collection = "Event"
};
}
I tried moving the dataprovider configuration to ConfigureServices method as well. I get the same error. Anything I am missing?
Thanks, Vani