Exemplo n.º 1
0
        }     //method

        // those members that do not have binding expressions, try mapping props with the same name
        private void AssignResolversByEntityPropertyNameMatch(ObjectTypeMapping mapping)
        {
            var entityType     = mapping.EntityType;
            var allEntFldProps = entityType.GetFieldsProps();

            foreach (var fldDef in mapping.TypeDef.Fields)
            {
                var res = mapping.GetResolver(fldDef);
                if (res.IsMapped())
                {
                    continue; //already set
                }
                var        memberName = fldDef.Name;
                MemberInfo entMember  = allEntFldProps.Where(m => m.Name.Equals(memberName, StringComparison.OrdinalIgnoreCase))
                                        .FirstOrDefault();
                if (entMember == null)
                {
                    continue;
                }
                res.ResolverFunc = ExpressionHelper.CompileMemberReader(entMember);
            } //foreach fldDef
        }