{"action":"created","issue":{"url":"https://api.github.com/repos/JoshClose/CsvHelper/issues/578","repository_url":"https://api.github.com/repos/JoshClose/CsvHelper","labels_url":"https://api.github.com/repos/JoshClose/CsvHelper/issues/578/labels{/name}","comments_url":"https://api.github.com/repos/JoshClose/CsvHelper/issues/578/comments","events_url":"https://api.github.com/repos/JoshClose/CsvHelper/issues/578/events","html_url":"https://github.com/JoshClose/CsvHelper/issues/578","id":177006001,"number":578,"title":"Inheritance mapping","user":{"login":"mrwillis","id":2652683,"avatar_url":"https://avatars.githubusercontent.com/u/2652683?v=3","gravatar_id":"","url":"https://api.github.com/users/mrwillis","html_url":"https://github.com/mrwillis","followers_url":"https://api.github.com/users/mrwillis/followers","following_url":"https://api.github.com/users/mrwillis/following{/other_user}","gists_url":"https://api.github.com/users/mrwillis/gists{/gist_id}","starred_url":"https://api.github.com/users/mrwillis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrwillis/subscriptions","organizations_url":"https://api.github.com/users/mrwillis/orgs","repos_url":"https://api.github.com/users/mrwillis/repos","events_url":"https://api.github.com/users/mrwillis/events{/privacy}","received_events_url":"https://api.github.com/users/mrwillis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-14T20:02:47Z","updated_at":"2016-09-14T21:44:43Z","closed_at":null,"body":"Hi,\r\n\r\nFirst off thanks for this library. It's incredible. Sorry if this is trivial but I just can't figure it out.\r\n\r\nI have a parent class \r\n\r\n```\r\n  public abstract class StructuredNote\r\n    {\r\n        public int Term { get; set; }\r\n        public decimal Fee { get; set; }\r\n        public DateTime AsOfDate { get; set; }\r\n    }\r\n```\r\nwith a map\r\n\r\n```\r\n   public sealed class StructuredNoteMap : CsvClassMap<StructuredNote>\r\n    {\r\n        public StructuredNoteMap()\r\n        {\r\n            Map(m => m.Fee).Name(\"sim_fee\");\r\n            Map(m => m.AsOfDate).Name(\"AsOfDate\");\r\n            Map(m => m.Term).ConvertUsing(row =>\r\n            {\r\n                int term;\r\n                if (!row.TryGetField(\"sim_term\", out term))\r\n                {\r\n                    if (row.GetField<string>(\"sim_term\").Any(Char.IsLetter))\r\n                        // parse failed so check if there are letters.\r\n                    {\r\n                        // Remove the letter and just take the integer.\r\n                        return Int32.Parse(Regex.Match(row.GetField<string>(\"sim_term\"), @\"\\d+\").Value);\r\n                    }\r\n                    // Otherwise there are no letters and it can't be converted.\r\n                    return -1;\r\n                }\r\n                return term;\r\n            });\r\n        }\r\n    }\r\n```\r\n\r\nand a child class\r\n\r\n```\r\n public class EquityLinkedNote: StructuredNote\r\n    {\r\n        public virtual List<VanillaOption> VanillaOptions { get; set; }\r\n\r\n    }\r\n```\r\n\r\nwith its own map:\r\n\r\n```\r\n public sealed class EquityLinkedMap : CsvClassMap<EquityLinkedNote>\r\n    {\r\n        public EquityLinkedMap()\r\n        {\r\n            Map(m => m.VanillaOptions).ConvertUsing(row =>\r\n            {\r\n                const string baseOptionString = \"sim_option\";\r\n                List<VanillaOption> options = new List<VanillaOption>();\r\n                for (int i = 1; i < 120; i++)\r\n                {\r\n                    VanillaOption option = MapHelper.GetOptionFromRow(row, baseOptionString + i);\r\n                    if (option != null)\r\n                        options.Add(option);\r\n                }\r\n\r\n                return options;\r\n            });\r\n        }\r\n    }\r\n```\r\nHow can I access the mappings from my parent class in my child class? I've tried registering multiple class maps but I realize that not what I'm looking for. Is there a way to inherit the mappings or something? \r\n\r\nThanks for your help. \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JoshClose/CsvHelper/issues/comments/247165135","html_url":"https://github.com/JoshClose/CsvHelper/issues/578#issuecomment-247165135","issue_url":"https://api.github.com/repos/JoshClose/CsvHelper/issues/578","id":247165135,"user":{"login":"JoshClose","id":114971,"avatar_url":"https://avatars.githubusercontent.com/u/114971?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshClose","html_url":"https://github.com/JoshClose","followers_url":"https://api.github.com/users/JoshClose/followers","following_url":"https://api.github.com/users/JoshClose/following{/other_user}","gists_url":"https://api.github.com/users/JoshClose/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshClose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshClose/subscriptions","organizations_url":"https://api.github.com/users/JoshClose/orgs","repos_url":"https://api.github.com/users/JoshClose/repos","events_url":"https://api.github.com/users/JoshClose/events{/privacy}","received_events_url":"https://api.github.com/users/JoshClose/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T21:44:43Z","updated_at":"2016-09-14T21:44:43Z","body":"I like James' way better."}}
{"actor":{"display_login":"JoshClose"}}