Skip to content

Commit

Permalink
! Solution to Issue #1 : exception raised when there were unmapped pr…
Browse files Browse the repository at this point in the history
…operties
  • Loading branch information
zorgoz committed Dec 27, 2016
1 parent 65b1cf9 commit 71db841
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions EPPlus.TableAsEnumerable.Tests/ComplexExampleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class Cars
[ExcelTableColumn(ColumnName = "Is ready for traffic?")]
public bool ready { get; set; }

public string unmappedProperty { get; set; }
public override string ToString()
{
return $"{(color.ToString())} {(manufacturer.ToString())} {(manufacturingDate?.ToShortDateString())}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="EPPlus, Version=4.1.0.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
<HintPath>..\EEPLus.TableAsEnumerable\packages\EPPlus.4.1.0\lib\net40\EPPlus.dll</HintPath>
<HintPath>..\packages\EPPlus.4.1.0\lib\net40\EPPlus.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -72,7 +72,6 @@
<Compile Include="EPPlusTableAsEnumerableTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<EmbeddedResource Include="Resources\testsheets.xlsx" />
</ItemGroup>
<ItemGroup>
Expand All @@ -81,7 +80,9 @@
<Name>EPPlus.TableAsEnumerable</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion EPPlus.TableAsEnumerable.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EPPlus" version="4.1.0" targetFramework="net40" />
<package id="EPPlus" version="4.1.0" targetFramework="net46" />
</packages>
2 changes: 1 addition & 1 deletion EPPlus.TableAsEnumerable/EPPlusAsEnumerableExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private static IList PrepareMappings<T>(ExcelTable table)
// Build property-table column mapping
foreach (var property in propInfo)
{
var mappingAttribute = (ExcelTableColumnAttribute)property.GetCustomAttributes(typeof(ExcelTableColumnAttribute), true).First();
var mappingAttribute = (ExcelTableColumnAttribute)property.GetCustomAttributes(typeof(ExcelTableColumnAttribute), true).FirstOrDefault();
if (mappingAttribute != null)
{
int col = -1;
Expand Down
2 changes: 1 addition & 1 deletion EPPlus.TableAsEnumerable/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EPPlus" version="4.1.0" targetFramework="net46" />
<package id="EPPlus" version="4.1.0" targetFramework="net40-client" />
</packages>

0 comments on commit 71db841

Please sign in to comment.