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

Obsolete Expression based stuff that can be replaced with nameof operator where possible #336

Open
mauroservienti opened this issue Jan 19, 2020 · 3 comments
Assignees
Milestone

Comments

@mauroservienti
Copy link
Member

No description provided.

@mauroservienti mauroservienti added this to the 2.1.0 milestone Jan 19, 2020
@nazarenomanco nazarenomanco self-assigned this Aug 15, 2020
@nazarenomanco
Copy link
Member

nazarenomanco commented Aug 15, 2020

@mauroservienti I have a problem... may you help me how to solve this without having entity?

        public EntityPropertyStates GetEntityPropertyState<TEntity>(TEntity entity, string propertyName)
        {
            var property = entity.GetType().GetProperty(propertyName);

            Ensure.That(property)
                .WithMessage("Cannot find property: {0}", propertyName)
                .IsNotNull();

            var state = EntityPropertyStates.None;

            if (TryGetOriginalValue(propertyName, out TProperty originalValue))
            {
                state |= EntityPropertyStates.Changed;

                TProperty actualValue;
                if (entity is Model.Entity e)
                {
                    actualValue = e.GetPropertyValue<TProperty>(propertyName);
                }
                else
                {
                    actualValue = (TProperty)property.GetValue(entity, null);
                }

                if (!Equals(originalValue, actualValue))
                {
                    state |= EntityPropertyStates.ValueChanged;
                }
            }

            return state;
        }

Thanks

@mauroservienti
Copy link
Member Author

Skip it, raise a dedicated issue and move forward. I have a couple of ideas but they are viral changes that might take a long time to tackle.

@mauroservienti mauroservienti removed this from the 2.1.0 milestone Sep 28, 2020
@mauroservienti
Copy link
Member Author

I'm not sure where this stands, removing it from the 2.1.0 milestone to get it out of the door. We can continue working on it for the next release.

@mauroservienti mauroservienti added this to the 2.2.0 milestone Sep 28, 2020
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

2 participants