-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LoadFromCollection - support for Dictionary properties (#1176)
* #969, #1058 - implemented EPPlusDictionaryColumnAttribute for LoadFromCollection with attributes * #969, #1058 - added support for Dictionary property in LoadFromCollection * #1058, #969 - LoadFromCollection, support for Dictionary property * #1058, #969 - added testclass * #1058, #969 - added unit test for reading column headers/keys from attribute
- Loading branch information
Showing
8 changed files
with
566 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/************************************************************************************************* | ||
Required Notice: Copyright (C) EPPlus Software AB. | ||
This software is licensed under PolyForm Noncommercial License 1.0.0 | ||
and may only be used for noncommercial purposes | ||
https://polyformproject.org/licenses/noncommercial/1.0.0/ | ||
A commercial license to use this software can be purchased at https://epplussoftware.com | ||
************************************************************************************************* | ||
Date Author Change | ||
************************************************************************************************* | ||
7/11/2023 EPPlus Software AB EPPlus 7 | ||
*************************************************************************************************/ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace OfficeOpenXml.Attributes | ||
{ | ||
/// <summary> | ||
/// This attributes can only be used on properties that are of the type IDictionary<string, string>. | ||
/// Columns will be added based on the items in <see cref="EPPlusDictionaryColumnAttribute.ColumnHeaders"/> | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field)] | ||
internal class EPPlusDictionaryColumnAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Order of the columns value, default value is 0 | ||
/// </summary> | ||
public int Order | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
/// <summary> | ||
/// The values of this array will be used to generate columns (one column for each item). | ||
/// </summary> | ||
public string[] ColumnHeaders { get; set; } | ||
|
||
/// <summary> | ||
/// Should be unique within all attributes. Will be used to retrieve the keys of the Dictionary | ||
/// that also will be used to create the columns for this property. | ||
/// </summary> | ||
public string KeyId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.