Closed SarcoZ closed 5 years ago
It would appear that I never updated UpdateOneModelFactory after the implementation of complex types. The result is that the method that builds property update definitions does not list any sub-document changes.
I'm putting in a change to build out those navigations, as well as to ensure that updates to non-owned/complex-type navigations (ie: the foreign key id) are also updated if a relationship changes.
These changes will hopefully also allow for push/pull of collections items.
I have a partial fix for this. I had to add a bunch of query tracking logic to attach the full graph, including "owned" child documents, to the state manager. Now it can actually see all of the modified sub-documents. I'm going to work tonight on making the actual update logic a little bit more robust: currently, it creates an update graph that spans the document from the root to each updated leaf node. I'd like to make that a little bit more concise and correctly use the update definitions to partially update sub-document children, and remove/add collection elements using MongoDb's syntax.
I apologize for how long this particular issue has taken. I started trying to fix this the cheap way, and then decided to do it the right way and ended up effectively re-writing the entire metadata system, half the MongoDB Linq adapter, most of the document conventions, and a bunch of other small issues. I don't get a lot of time to work on the provider, so it's taken me a month and a half of a couple of hours here and there.
I have a branch with the current set of changes. I need to tweak a few more things to get the Identity tests to pass, but this issue is almost fixed. Please bear with me a little longer.
I finally just got the last bit of this done. This reflects an effectively complete overhaul of the provider for the nearly sole purpose of tracking subdocument modifications.
@crhairr Good,T will try later
Does that mean framework can go on release instead of pre-release?
Unfortunately not.
EFCore 3.0 fixes a lot of the underlying issues preventing toss MongoDB provider from being production worthy. I was working on that update when my wife's health developed some complications. We are now in the middle of a cross-country move to address that, and this project has taken a bit of a backseat.
I would be happy to review and accept pull requests when things start to settle back down.
[MongoDatabase("fengpintech")] public class MongoContext : DbContext { Customers { get; set; }
public DbSet
public class Customer { ///
/// Key
///
[BsonId]
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public ObjectId Id { get; private set; }
my test code is:
class Program { static void Main(string[] args) { var services = new ServiceCollection(); services.AddDbContext(options =>
options.UseMongoDb("mongodb://localhost"));
customer save success,then I add a child Aptitudes instance,but can not save