My Domain Classes is as follow:
public class Author
{
public int Id { get; set; }
public string Name { get; set; }
public IList<Post> Posts { get; set; }
}
public class Blog
{
public int Id { get; set; }
public string Name { get; set; }
public IList<Post> Posts { get; set; }
}
public class Post
{
public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public Author Author { get; set; }
public Blog Blog { get; set; }
}
As you see I have absolutely not any data annotation or attributes for entity framework annotations, and I Configure Entity framework related annotations in another classes for each one using entity framework fluent api. now I want to replace entity framework with MangoDb.
but in mongo db I needed to place an attribute at list for Id like below:
public class Author
{
[BsonElement("_id")]
[BsonRepresentation(BsonType.ObjectId)]
public int Id { get; set; }
public string Name { get; set; }
public IList<Post> Posts { get; set; }
}
My Question is is there any way to this configuration outside in another class, and don't touch my poco classes like what we use in entity framework's fluent api.