コード例 #1
0
        private IList <T> ParseResult(ArchiveExecutionContext executionContext, IList <ArchiveListItem> list)
        {
            List <T> results = new List <T>();

            if (list == null)
            {
                return(null);
            }

            foreach (ArchiveListItem item in list)
            {
                T t = Activator.CreateInstance <T>();
                foreach (string column in item.ColumnData.Keys)
                {
                    foreach (string propertyName in DynamicPropertyHelper.GetPropertyNames <T>(column))
                    {
                        string value       = item.ColumnData[column].DisplayValue;
                        object parsedValue = CultureDataFormatter.ParseEncoded(value);

                        parsedValue = DoTypeSpecificConversion(executionContext, DynamicPropertyHelper.GetColumnInfo(typeof(T), propertyName), parsedValue);
                        ObjectPropertyAccessor.SetValue(t, propertyName, parsedValue);
                    }
                }
                results.Add(t);
            }
            return(results);
        }
コード例 #2
0
        public void TestGetColumnInfo(string propertyName, bool hasRawDbDataOn)
        {
            ColumnInfo result = DynamicPropertyHelper.GetColumnInfo(typeof(PropertyHelperTestCompany), propertyName);

            Assert.Equal("activated", result.Name);
            Assert.Equal(hasRawDbDataOn, result.UseRaw);
        }