{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6568","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6568/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6568/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6568/events","html_url":"https://github.com/aspnet/EntityFramework/issues/6568","id":177646741,"number":6568,"title":"How to get ignored properties","user":{"login":"xyting","id":14950276,"avatar_url":"https://avatars.githubusercontent.com/u/14950276?v=3","gravatar_id":"","url":"https://api.github.com/users/xyting","html_url":"https://github.com/xyting","followers_url":"https://api.github.com/users/xyting/followers","following_url":"https://api.github.com/users/xyting/following{/other_user}","gists_url":"https://api.github.com/users/xyting/gists{/gist_id}","starred_url":"https://api.github.com/users/xyting/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xyting/subscriptions","organizations_url":"https://api.github.com/users/xyting/orgs","repos_url":"https://api.github.com/users/xyting/repos","events_url":"https://api.github.com/users/xyting/events{/privacy}","received_events_url":"https://api.github.com/users/xyting/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-18T11:33:14Z","updated_at":"2016-09-18T11:33:14Z","closed_at":null,"body":"I want EFCore to auto record the change history so that I can undo and redo from the change history.\r\n\r\nThe repo is [RigoFunc.DAL](https://github.com/xyting/RigoFunc.DAL)\r\n\r\nSo I add some extension method to ``DbContext`` like [this](https://github.com/xyting/RigoFunc.DAL/blob/master/src/RigoFunc.DAL/Extensions/DbContextExtensions.cs#L59-L76), but if the POCO model have some properties had been configured ignored,  the code will throw exception, so I change the  code like following\r\n\r\n```csharp\r\nprivate static object Original(this EntityEntry entry) {\r\n            var type = entry.Entity.GetType();\r\n            var entity = Activator.CreateInstance(type, true);\r\n\r\n            var properties = type.GetTypeInfo().GetProperties();\r\n            foreach (var property in properties) {\r\n                var nav = entry.Metadata.FindNavigation(property);\r\n                if(nav != null) {\r\n                    continue;\r\n                }\r\n\r\n                try {\r\n                    var propertyEntry = entry.Property(property.Name);\r\n                    // the Ignore property will be null\r\n                    if (propertyEntry == null) {\r\n                        continue;\r\n                    }\r\n\r\n                    var original = propertyEntry.OriginalValue;\r\n                    property.SetValue(entity, original);\r\n                }\r\n                catch {\r\n                    // following code will throw exception if the property had been ignored.\r\n                    // var propertyEntry = entry.Property(property.Name);\r\n                }\r\n            }\r\n\r\n            return entity;\r\n        }\r\n```\r\n\r\nMy question is what's the best way to get the POCO mode ignored properties"}}
{"actor":{"display_login":"xyting"}}