/// <summary> /// Property Level: Adds a property handler mapping into a data entity type property (via <see cref="Field"/> object). It uses the <see cref="Activator.CreateInstance(Type)"/> method to create the instance of target property handler. /// Make sure a default constructor is available for the type of property handler, otherwise an exception will be thrown. /// </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="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, bool force) where TEntity : class => Add <TEntity, TPropertyHandler>(field, Activator.CreateInstance <TPropertyHandler>(), false);
/// <summary> /// Property Level: Gets the mapped property handler object of the data entity type property (via <see cref="Field"/> object). /// </summary> /// <typeparam name="TEntity">The type of the data entity.</typeparam> /// <typeparam name="TPropertyHandler">The type of the property handler.</typeparam> /// <param name="field">The instance of <see cref="Field"/> object.</param> /// <returns>The mapped property handler object of the property.</returns> public static TPropertyHandler Get <TEntity, TPropertyHandler>(Field field) where TEntity : class => Get <TEntity, TPropertyHandler>(TypeExtension.GetProperty <TEntity>(field.Name));
/// <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> public static void Add <TEntity, TPropertyHandler>(Field field, TPropertyHandler propertyHandler) where TEntity : class => Add <TEntity, TPropertyHandler>(field, propertyHandler, false);