[CSHARP-56] Mapping of subclass members doesn't work Created: 14/Aug/10  Updated: 19/Oct/16  Resolved: 08/Sep/10

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: nisbus Assignee: Craig Wilson
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows



 Description   

Consider this mapping of a subclass that has a property that I want ignored:

mapping.DefaultProfile(profile =>

{ profile.SubClassesAre(t => t.IsSubclassOf(typeof(MyAbstract))); }

);
mapping.Map<MyConcrete>(c =>

{ c.Member(x => x.MyProperty).Ignore(); }

);

The MyProperty of MyConcrete (which is a subclass of MyAbstract) doesn´t get ignored until I add this:

mapping.Map<MyAbstract>(f =>

{ f.Member(x => x.MyProperty).Ignore(); }

);

This is works for my case but I can foresee cases where I would want one concrete class to ignore this property of the abstract while I would want to include it in another.



 Comments   
Comment by Craig Wilson [ 08/Sep/10 ]

This is by design. We map based on the base class's member because otherwise the linq provider wouldn't react properly. Therefore, anything in a base class that is not ignored will be persisted.

Generated at Wed Feb 07 21:35:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.