Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void CreateMapForEF<TDto, TEntity>()
- {
- Mapper.CreateMap<TDto, TEntity>()
- .ForAllMembers(o => o.Condition(ctx =>
- {
- var members = ctx.Parent.SourceType.GetMember(ctx.MemberName); // get the MemberInfo that we are mapping
- if (!members.Any())
- return false;
- if (members.First().GetCustomAttributes(
- typeof (EdmRelationshipNavigationPropertyAttribute), false).Any())
- return false;
- return members.First().GetCustomAttributes(typeof(EdmScalarPropertyAttribute), false).Any(); // determine if the Member has the EdmScalar attribute set
- }));
- }
Add Comment
Please, Sign In to add comment