/// <summary> /// Adds a property handler mapping into a data entity type property (via <see cref="Field"/> object). /// </summary> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="field">The instance of <see cref="Field"/> object to be mapped.</param> /// <param name="propertyHandler">The instance of the property handler.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> /// <returns>The current instance.</returns> public EntityMapFluentDefinition <TEntity> PropertyHandler <TPropertyHandler>(Field field, TPropertyHandler propertyHandler, bool force) { PropertyHandlerMapper.Add <TEntity, TPropertyHandler>(field, propertyHandler, force); return(this); }
/// <summary> /// Defines a mapping between a data entity type property and a property handler object. /// </summary> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="expression">The expression to be parsed.</param> /// <param name="propertyHandler">The instance of the property handler.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> /// <returns>The current instance.</returns> public EntityMapFluentDefinition <TEntity> PropertyHandler <TPropertyHandler>(Expression <Func <TEntity, object> > expression, TPropertyHandler propertyHandler, bool force) { PropertyHandlerMapper.Add <TEntity, TPropertyHandler>(expression, propertyHandler, force); return(this); }
/// <summary> /// Adds a property handler mapping into a data entity type property (via property name). /// </summary> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="propertyName">The name of the class property to be mapped.</param> /// <param name="propertyHandler">The instance of the property handler.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> /// <returns>The current instance.</returns> public EntityMapFluentDefinition <TEntity> PropertyHandler <TPropertyHandler>(string propertyName, TPropertyHandler propertyHandler, bool force) { PropertyHandlerMapper.Add <TEntity, TPropertyHandler>(propertyName, propertyHandler, force); return(this); }
/* * Add */ /// <summary> /// Property Level: Adds a property handler mapping into a data entity type property (via expression). /// </summary> /// <typeparam name="TEntity">The type of the data entity.</typeparam> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="expression">The expression to be parsed.</param> /// <param name="propertyHandler">The instance of the property handler.</param> public static void Add <TEntity, TPropertyHandler>(Expression <Func <TEntity, object> > expression, TPropertyHandler propertyHandler) where TEntity : class => PropertyHandlerMapper.Add <TEntity, TPropertyHandler>(expression, propertyHandler, false);
/// <summary> /// Maps the property handler to be used by the current target property. /// </summary> /// <typeparam name="TPropertyHandler">The type of the handler.</typeparam> /// <param name="propertyHandler">The instance of the handler.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> /// <returns>The current instance.</returns> public IPropertyOptions <TEntity> PropertyHandler <TPropertyHandler>(TPropertyHandler propertyHandler, bool force) { PropertyHandlerMapper.Add(m_expression, propertyHandler); return(this); }
/* * Add */ /// <summary> /// Type Level: Adds a mapping between a .NET CLR type and a <see cref="IPropertyHandler{TInput, TResult}"/> object. /// </summary> /// <typeparam name="TType">The target .NET CLR type.</typeparam> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="propertyHandler">The instance of the property handler. The type must implement the <see cref="IPropertyHandler{TInput, TResult}"/> interface.</param> /// <param name="force">Set to true if to override the existing mapping, otherwise an exception will be thrown if the mapping is already present.</param> public static void Add <TType, TPropertyHandler>(TPropertyHandler propertyHandler, bool force = false) => PropertyHandlerMapper.Add(typeof(TType), propertyHandler, force);
/// <summary> /// Type Level: Adds a mapping between a .NET CLR type and a <see cref="IPropertyHandler{TInput, TResult}"/> object. /// </summary> /// <param name="type">The target .NET CLR type.</param> /// <param name="propertyHandler">The instance of the property handler. The type must implement the <see cref="IPropertyHandler{TInput, TResult}"/> interface.</param> /// <param name="force">Set to true if to override the existing mapping, otherwise an exception will be thrown if the mapping is already present.</param> public static void Add(Type type, object propertyHandler, bool force = false) => PropertyHandlerMapper.Add(type, propertyHandler, force);
/// <summary> /// Property Level: Adds a property handler mapping into a data entity type property (via property name). /// </summary> /// <typeparam name="TEntity">The target .NET CLR type.</typeparam> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="propertyName">The instance of property handler.</param> /// <param name="propertyHandler">The instance of property handler.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> public static void Add <TEntity, TPropertyHandler>(string propertyName, TPropertyHandler propertyHandler, bool force) where TEntity : class => PropertyHandlerMapper.Add <TEntity, TPropertyHandler>(propertyName, propertyHandler, force);
/// <summary> /// Property Level: Adds a property handler mapping into a data entity type property (via <see cref="Field"/> object). /// </summary> /// <typeparam name="TEntity">The target .NET CLR type.</typeparam> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="field">The instance of <see cref="Field"/> object to be mapped.</param> /// <param name="propertyHandler">The instance of the property handler.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> public static void Add <TEntity, TPropertyHandler>(Field field, TPropertyHandler propertyHandler, bool force) where TEntity : class => PropertyHandlerMapper.Add <TEntity, TPropertyHandler>(field, propertyHandler, force);
/// <summary> /// Property Level: Adds a property handler mapping into a data entity type property (via expression). /// </summary> /// <typeparam name="TEntity">The type of the data entity.</typeparam> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="expression">The expression to be parsed.</param> /// <param name="propertyHandler">The instance of the property handler.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> public static void Add <TEntity, TPropertyHandler>(Expression <Func <TEntity, object> > expression, TPropertyHandler propertyHandler, bool force) where TEntity : class => PropertyHandlerMapper.Add <TEntity, TPropertyHandler>(ExpressionExtension.GetProperty <TEntity>(expression), propertyHandler, force);
/// <summary> /// Defines a mapping between a .NET CLR type and a <see cref="IPropertyHandler{TInput, TResult}"/> object. /// </summary> /// <typeparam name="TPropertyHandler">The type of the handler.</typeparam> /// <param name="propertyHandler">The instance of the property handler. The type must implement the <see cref="IPropertyHandler{TInput, TResult}"/> interface.</param> /// <param name="force">A value that indicates whether to force the mapping. If one is already exists, then it will be overwritten.</param> /// <returns>The current instance.</returns> public TypeMapFluentDefinition <TType> PropertyHandler <TPropertyHandler>(TPropertyHandler propertyHandler, bool force) { PropertyHandlerMapper.Add <TType, TPropertyHandler>(propertyHandler, force); return(this); }
/// <summary> /// Type Level: Adds a mapping between the .NET CLR Type and a property handler. /// </summary> /// <param name="type">The .NET CLR Type.</param> /// <param name="propertyHandler">The instance of the property handler. The type must implement the <see cref="IPropertyHandler{TInput, TResult}"/> interface.</param> /// <param name="override">Set to true if to override the existing mapping, otherwise an exception will be thrown if the mapping is already present.</param> public static void Add(Type type, object propertyHandler, bool @override = false) => PropertyHandlerMapper.Add(type, propertyHandler, @override);
/* * Add */ /// <summary> /// Type Level: Adds a mapping between the .NET CLR Type and a property handler. /// </summary> /// <typeparam name="TType">The .NET CLR type.</typeparam> /// <typeparam name="TPropertyHandler">The type of the handler.</typeparam> /// <param name="propertyHandler">The instance of the property handler. The type must implement the <see cref="IPropertyHandler{TInput, TResult}"/> interface.</param> /// <param name="override">Set to true if to override the existing mapping, otherwise an exception will be thrown if the mapping is already present.</param> public static void Add <TType, TPropertyHandler>(TPropertyHandler propertyHandler, bool @override = false) => PropertyHandlerMapper.Add(typeof(TType), propertyHandler, @override);
public IPropertyOptions <T> PropertyHandler <THandler>(THandler propertyHandler) { PropertyHandlerMapper.Add(m_expression, propertyHandler); return(this); }