< Summary

Information
Class: MyNet.Metadata.PropertyBuilder<T1, T2>
Assembly: MyNet.Metadata
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Metadata/PropertyBuilder.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 38
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Metadata()100%11100%
Feature(...)100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Metadata/PropertyBuilder.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="PropertyBuilder.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8
 9namespace MyNet.Metadata;
 10
 11/// <summary>
 12/// Provides a builder for configuring metadata for a specific property of a type. This class allows for the fluent conf
 13/// </summary>
 14/// <param name="metadata">The metadata associated with the property being configured.</param>
 15/// <typeparam name="T">The type that owns the property being configured.</typeparam>
 16/// <typeparam name="TProperty">The type of the property being configured.</typeparam>
 17public sealed class PropertyBuilder<T, TProperty>(PropertyMetadata metadata)
 18{
 19    /// <summary>
 20    /// Gets the underlying property metadata being configured.
 21    /// </summary>
 3922    public PropertyMetadata Metadata => metadata;
 23
 24    /// <summary>
 25    /// Specifies a feature or attribute that should be associated with the property being configured. This method allow
 26    /// </summary>
 27    /// <param name="configure">An action that configures the feature for the property.</param>
 28    /// <typeparam name="TFeature">The type of the feature to associate with the property.</typeparam>
 29    /// <returns>The current <see cref="PropertyBuilder{T, TProperty}"/> instance for fluent configuration.</returns>
 30    public PropertyBuilder<T, TProperty> Feature<TFeature>(Action<TFeature> configure)
 31        where TFeature : class, new()
 32    {
 333        var feature = metadata.GetOrCreate<TFeature>();
 334        configure(feature);
 335        return this;
 36    }
 37}
 38