/// <summary>
 /// Instantiates the class using default components
 /// </summary>
 /// <param name="dbContext">Context in which to perform the merge operation</param>
 /// <param name="modelsNamespace">Namespace in which all context entities are defined (all models must be within
 /// the same namespace. If model type is in a different namespace, an exception will be thrown when instantiating
 /// the type. This is, hopefully, a temporary workaround, until I find a good solution for this)</param>
 /// <param name="modelAssemblyName">Name of assembly which contains all context enties. Again, just like with the
 /// namespace parameter, this is a temporary workaround</param>
 public DefaultEntityChangesMerger(DbContext dbContext, string modelsNamespace, string modelAssemblyName)
 {
     DbContext        = dbContext;
     reflector        = new DbContextReflector(DbContext, modelsNamespace, modelAssemblyName);
     scalarUpdater    = new ScalarPropertyUpdater(DbContext, reflector);
     entityComparer   = new EntityComparerByNonForeignKeys();
     collectionMerger = new CollectionMerger(entityComparer);
     navUpdater       = new NavigationPropertyUpdater(DbContext, scalarUpdater, reflector);
 }
 public EntityUpdater(DbContext dbContext, IDbContextReflector reflector, IEntityUpdater scalarPropertyUpdater, ICollectionMerger collectionMerger)
     : base(dbContext, scalarPropertyUpdater)
 {
     Reflector        = reflector;
     CollectionMerger = collectionMerger;
 }
        public void Setup()
        {
            IEntityComparerByKeys comparer = new EntityComparerByNonForeignKeys();

            merger = new CollectionMerger(comparer);
        }
Пример #4
0
 public CollectionPropertyUpdater(DbContext dbContext, TModel model, ICollectionMerger collectionMerger)
 {
     DbContext        = dbContext;
     Model            = model;
     CollectionMerger = collectionMerger;
 }