Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore does not appear to work #4

Open
PhilipDaniels opened this issue Aug 30, 2017 · 0 comments
Open

Ignore does not appear to work #4

PhilipDaniels opened this issue Aug 30, 2017 · 0 comments

Comments

@PhilipDaniels
Copy link

Given a model

public class Car
    {
        public Car()
        {
            Bag = new Dictionary<string, object>();
        }

        public IDictionary<string, object> Bag { get; }
    }

I want to ignore all changes in the Bag. I expected this to work

        [Fact]
        public void Ignore_ShouldIgnoreCollections()
        {
            var original = new Car();
            var current = new Car();

            current.Bag["foo"] = "bar";

            var configuration = new Configuration();
            configuration.Configure(config => config
                .Entity<Car>(e =>
                {
                    e.Property(p => p.Bag).Ignore();
                    //e.Collection(p => p.Bag).Ignore();
                }));

            var comparer = new EntityComparer(configuration);

            var changes = comparer.Compare(original, current);
            changes.Count.Should().Be(0);
        }

But I get 1 diff. The commented out Ignore() does not help either.

I believe the error may be in EntityComparer.CompareObject. Changing the loop as below fixes the issue, but I don't know if there are other ramifications.

            foreach (var memberMapping in classMapping.Members)
            {
                if (memberMapping.Ignored)
                    continue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant