Search Results for

    Show / Hide Table of Contents
    View Source

    Class NullableDateMapper

    Extends NPoco default mapper and ensures that nullable dates are not saved to the database.

    Inheritance
    object
    Namespace: Umbraco.Cms.Infrastructure.Persistence.Mappers
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public class NullableDateMapper : DefaultMapper

    Constructors

    View Source

    NullableDateMapper()

    Declaration
    public NullableDateMapper()

    Methods

    View Source

    GetToDbConverter(Type, MemberInfo)

    Returns a converter function that transforms a nullable System.DateTime value into a database-compatible value, ensuring that invalid dates (such as System.DateTime.MinValue) are not stored.

    Declaration
    public override Func<object, object?>? GetToDbConverter(Type destType, MemberInfo sourceMemberInfo)
    Parameters
    Type Name Description
    Type destType

    The type expected by the database column.

    MemberInfo sourceMemberInfo

    The reflection metadata for the source member being mapped.

    Returns
    Type Description
    Func<object, object>

    A function that takes an object (expected to be a nullable System.DateTime) and returns either a valid System.DateTime value or null if the value is null or System.DateTime.MinValue; returns null if the source member is not a System.DateTime.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX