Beispiel #1
0
        public void GetPropertyMappings_OnePropertyWithMatchingColumn_ReturnsCollectionWithCorrectResult()
        {
            DataTable dt = DataTableFactory.GenerateEmptyDataTableWithStringColumns("PropertyOne");

            ICollection <ExtendedPropertyInfo> results = defaultMappingResolver.GetPropertyMappings <SimpleOnePropertyNoIdNoAttributes>(dt, defaultDataTableParserSettings);

            ExtendedPropertyInfo propInfo = results.First();

            Assert.True(propInfo.FieldName == "PropertyOne");

            Assert.True(propInfo.ColumnIndex == 0);
        }
Beispiel #2
0
        public static ExtendedPropertyInfo[] CreatePropertyMappingsDirectlyMatchingObject <T>()
        {
            PropertyInfo[] properties = typeof(T).GetProperties();

            var extendedProperties = new ExtendedPropertyInfo[properties.Length];

            for (int i = 0; i < properties.Length; i++)
            {
                extendedProperties[i] = new ExtendedPropertyInfo(properties[i].Name, properties[i], -1);
            }

            return(extendedProperties);
        }
 internal object OnGetPropertyValue(ExtendedPropertyInfo extendedProperty, object extendee)
 {
     object value = null;
     if (extendedProperty.Name.Equals("Location", StringComparison.Ordinal))
         value = (ActiveDesigner == null) ? Location : this._stateLocation;
     else if (extendedProperty.Name.Equals("Size", StringComparison.Ordinal))
         value = (ActiveDesigner == null) ? Size : this._stateSize;
     return value;
 }