Base solution for your next web application
Open Closed

Support MongoDB data store? #7032


User avatar
0
dzungle created

Hello support team,

We're using MongoDB as the data store for one of our modules. We want to create some entities in the Domain layer ( .Core project). Is it possible that our entities can directly inherit from FullAuditedEntity?

Thank you very much.

Dzung Le


5 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    There is no explicit support, but you can try.

    https://support.aspnetzero.com/QA/Questions?Filter=Mongodb

  • User Avatar
    0
    hikalkan created
    Support Team

    You can use MongoDB with its own API. I think you don't have problems on inheriting from FullAuditedEntity. However, audit properties are not filled automatically and you can not inject a repository for your entity. You should go with MongoDB's capabilities, AspNet Zero has no additional service for MongoDB.

  • User Avatar
    0
    dzungle created

    Hi hikalkan,

    We want to build such a MongoDB repository that can be integrated with aspnet zero. Can you show me the best approach to do this? It's hightly appreciated if you have any sample code for that.

    Thank you very much.

  • User Avatar
    0
    hikalkan created
    Support Team

    You can always implement your own repository.

    For example, you can take this as an example:

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.MongoDB/MongoDb/Repositories/MongoDbRepositoryBase.cs

    (This is an experimantel package and no official support)

    Create a base repository class like this. Insted of injecting IMongoDatabaseProvider, directly use mongodb APIs. Then derive your repositories from this class and manually register to dependency injection.

    Since AspNet Zero does not support MongoDb, this is out of support actually. But if you implement it and have a specific question (rather than a full implementation suggestion), we can try to help you.

    Have a nice day.

  • User Avatar
    1
    dzungle created

    Thank you very much