< Summary

Information
Class: MyNet.Metadata.MetadataBuilder<T>
Assembly: MyNet.Metadata
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Metadata/MetadataBuilder.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 39
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
.ctor(...)100%11100%
Property(...)100%11100%

File(s)

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="MetadataBuilder.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Linq.Expressions;
 9using MyNet.Primitives;
 10
 11namespace MyNet.Metadata;
 12
 13/// <summary>
 14/// Provides a builder for constructing metadata for a specific type. This class allows for the fluent configuration of 
 15/// </summary>
 16/// <typeparam name="T">The type for which metadata is being constructed.</typeparam>
 17public sealed class MetadataBuilder<T>
 18{
 19    private readonly TypeMetadata _metadata;
 20
 21    /// <summary>
 22    /// Initializes a new instance of the <see cref="MetadataBuilder{T}"/> class with the specified type metadata. This 
 23    /// </summary>
 24    /// <param name="metadata">The type metadata that provides access to the overall metadata for the type.</param>
 3025    internal MetadataBuilder(TypeMetadata metadata) => _metadata = metadata;
 26
 27    /// <summary>
 28    /// Specifies the property for which metadata is being configured. This method takes an expression that identifies t
 29    /// </summary>
 30    /// <param name="expression">A lambda expression that identifies the property being configured.</param>
 31    /// <typeparam name="TProperty">The type of the property being configured.</typeparam>
 32    /// <returns>A <see cref="PropertyBuilder{T,TProperty}"/> that can be used to further configure the metadata for the
 33    public PropertyBuilder<T, TProperty> Property<TProperty>(Expression<Func<T, TProperty>> expression)
 34    {
 3035        var name = expression.PropertyInfo.Name;
 3036        return new(_metadata.GetProperty(name));
 37    }
 38}
 39