コード例 #1
0
        public void Build()
        {
            NameForPath.Clear();
            var properties    = DeclaringType.GetProperties();
            var typeAttribute = DeclaringType.GetCustomAttribute <DataSourceAttribute>();

            foreach (var property in properties)
            {
                var attribute = property.GetCustomAttribute <DataColumnAttribute>();
                if (attribute != null && !attribute.IsExternalData)
                {
                    var prefix = (Name ?? typeAttribute.TableName) + ".";
                    if (prefix == ".")
                    {
                        prefix = string.Empty;
                    }
                    NameForPath[property.Name] = prefix + attribute.ColumnName;
                }
            }
            foreach (var property in properties)
            {
                var attribute = property.GetCustomAttribute <DataColumnAttribute>();
                if (attribute != null && attribute.IsExternalData)
                {
                    NameForPath[property.Name] = attribute.ColumnName;
                }
            }
        }