private void Join <SubType>(ClasslikeMapBase <T> map, Action <ClasslikeMapBase <SubType> > action, string tableName) where SubType : EntityBase { var t = typeof(T); var st = typeof(SubType); tableName = string.IsNullOrEmpty(tableName) ? st.Name : tableName; var subclassMap = new SubclassMap <SubType>(); subclassMap.Extends <T>(); using (_mapper.OverrideJoinContext("[" + tableName + "]", tableName + "ID")) { if (subclassMap.AnythingToMap()) { subclassMap.Join(_mapper.JoinContext.TableName, x => { x.KeyColumn(_mapper.JoinContext.KeyColumnName); x.AutoMap(); if (action != null) { action(x); } }); } else if (action != null) { action(subclassMap); } } _mapper.Config.FluentMappings.Add(subclassMap); }
private void Subclass <TSubType>(ClasslikeMapBase <T> mapping, Action <ClasslikeMapBase <TSubType> > action) where TSubType : EntityBase { var t = typeof(T); var st = typeof(TSubType); var subclassMap = new SubclassMap <TSubType>(); subclassMap.Extends <T>(); if (_mapper.JoinContext != null) { if (subclassMap.AnythingToMap()) { subclassMap.Join(_mapper.JoinContext.TableName, x => { x.KeyColumn(_mapper.JoinContext.KeyColumnName); x.AutoMap(); if (action != null) { action(x); } }); } else if (action != null) { action(subclassMap); } } else { if (subclassMap.AnythingToMap()) { subclassMap.AutoMap(); } if (action != null) { action(subclassMap); } } _mapper.Config.FluentMappings.Add(subclassMap); }