-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for value converter attribute (#408)
* Column value converter attribute support * Revert "Column value converter attribute support" This reverts commit 7a5b050. * Column value converter attribute support
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 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
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,30 @@ | ||
// <copyright company="PetaPoco - CollaboratingPlatypus"> | ||
// Apache License, Version 2.0 https://github.com/CollaboratingPlatypus/PetaPoco/blob/master/LICENSE.txt | ||
// </copyright> | ||
// <author>PetaPoco - CollaboratingPlatypus</author> | ||
// <date>2017/07/20</date> | ||
|
||
using System; | ||
|
||
namespace PetaPoco | ||
{ | ||
/// <summary> | ||
/// Represents an attribute which can decorate a Poco property conver value from database type to property type and conversely. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Property)] | ||
public abstract class ValueConverterAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Function to convert property value to database type value. | ||
/// </summary> | ||
/// <param name="value">Property value</param> | ||
/// <returns>Converted database value</returns> | ||
public abstract object ConvertToDb(object value); | ||
/// <summary> | ||
/// Function to convert database value to property type value. | ||
/// </summary> | ||
/// <param name="value">Database value</param> | ||
/// <returns>Converted property type value</returns> | ||
public abstract object ConvertFromDb(object value); | ||
} | ||
} |
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