Exemplo n.º 1
0
        private IEnumerable <IObjectMemberContext> WalkDataMembers()
        {
            ObjectWalker walker = new ObjectWalker(
                delegate(MemberInfo member) { return(AttributeUtils.HasAttribute <CommandLineParameterAttribute>(member)); });

            walker.IncludeNonPublicFields     = true;
            walker.IncludeNonPublicProperties = true;
            return(walker.Walk(this));
        }
Exemplo n.º 2
0
            /// <summary>
            /// Get a list of properties and fields from a data contract that satisfy the predicate.
            /// </summary>
            protected static IEnumerable <IObjectMemberContext> GetDataMemberFields(object dataObject, Predicate <MemberInfo> memberTest)
            {
                var walker = new ObjectWalker(memberTest)
                {
                    IncludeNonPublicFields     = true,
                    IncludeNonPublicProperties = true
                };

                return(walker.Walk(dataObject));
            }
Exemplo n.º 3
0
        private static Dictionary<string, PropertyInfo> LoadMap(Type entityType)
        {
            ObjectWalker walker = new ObjectWalker();
            Dictionary<string, PropertyInfo> propMap = new Dictionary<string, PropertyInfo>();

            foreach (IObjectMemberContext member in walker.Walk(entityType))
            {
                EntityFieldDatabaseMappingAttribute map =
                    AttributeUtils.GetAttribute<EntityFieldDatabaseMappingAttribute>(member.Member);
                if (map != null)
                {
                    propMap.Add(map.ColumnName, member.Member as PropertyInfo);
                }
            }

            return propMap;
        }
Exemplo n.º 4
0
        protected static Dictionary<string, string> GetColumnMap(Type entityType)
        {
            ObjectWalker walker = new ObjectWalker();
            Dictionary<string, string> propMap = new Dictionary<string, string>();

            foreach (IObjectMemberContext member in walker.Walk(entityType))
            {
                EntityFieldDatabaseMappingAttribute map =
                    AttributeUtils.GetAttribute<EntityFieldDatabaseMappingAttribute>(member.Member);
                if (map != null)
                {
                    propMap.Add(member.Member.Name, map.ColumnName);
                }
            }

            return propMap;
        }