Mongodb support #183
-
using EF is it supported to use MongoDb as database on the server? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I haven't seen an implementation using MongoDB, however all the facilities are available to support it. You will probably have to create your own version of the EntityTableData that explicitly supports the requirements of MongoDB. Failing that, you can write your own repository for MongoDB, assuming the .NET driver for MongoDB supports IQueryable, you should have no problem. Try it and let us know how you get on! If you have problems, publish a public repo with your work and we'll see how to help. |
Beta Was this translation helpful? Give feedback.
-
i've made as you suggested write my own version of EntityTableData and so far it seems to work well (i'm in a earlyy stage of development) public class MongoDBEntity : EntityTableData
{
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[UpdatedByRepository]
public override DateTimeOffset? UpdatedAt { get; set; } = DateTimeOffset.UnixEpoch;
[Timestamp]
[UpdatedByRepository]
public override byte[] Version { get; set; } = Array.Empty<byte>();
} |
Beta Was this translation helpful? Give feedback.
-
I've created a new MongoDB Driver for 9.0.0 - the database structure may NOT be the same as the EF Core one, so bear that in mind. Mongo has not created a driver for EF Core 9.x yet (it's in progress) so you will want to decide on whether to switch or wait when 9.0.0 comes out. |
Beta Was this translation helpful? Give feedback.
i've made as you suggested write my own version of EntityTableData and so far it seems to work well (i'm in a earlyy stage of development)