Files
Core.BluePrint.Packages/Core.Blueprint.Mongo/Attributes/CollectionAttributeName.cs
Sergio Matias Urquin 83fc1878c4 Add project files.
2025-04-29 18:42:29 -06:00

25 lines
1.1 KiB
C#

namespace Core.Blueprint.Mongo
{
/// <summary>
/// The <see cref="CollectionAttributeName"/> attribute is used to specify the name of a MongoDB collection
/// that a class should be mapped to. This attribute can be applied to classes that represent MongoDB entities.
/// </summary>
[AttributeUsage(AttributeTargets.Class)] // This attribute can only be applied to classes.
public class CollectionAttributeName : Attribute
{
/// <summary>
/// Gets or sets the name of the MongoDB collection that the class is mapped to.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="CollectionAttributeName"/> class with the specified collection name.
/// </summary>
/// <param name="name">The name of the MongoDB collection that the class should be mapped to.</param>
public CollectionAttributeName(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name), "Collection name cannot be null.");
}
}
}