initial files
This commit is contained in:
21
BinaryDad.Extensions/Annotations/CommandFlagAttribute.cs
Normal file
21
BinaryDad.Extensions/Annotations/CommandFlagAttribute.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
|
||||
namespace BinaryDad.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Binds data from command line flags to attached property. In the example, [<see cref="CommandFlagAttribute"/>("context")] public string Context { get; set; }, a command of "command.exe -context Production" will set Context property equal to "Production".
|
||||
/// </summary>
|
||||
public class CommandFlagAttribute : Attribute
|
||||
{
|
||||
public string Flag { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the flag, without the preceding dash (-)
|
||||
/// </summary>
|
||||
/// <param name="flag"></param>
|
||||
public CommandFlagAttribute(string flag)
|
||||
{
|
||||
Flag = flag;
|
||||
}
|
||||
}
|
||||
}
|
10
BinaryDad.Extensions/Annotations/DataRowPopulateAttribute.cs
Normal file
10
BinaryDad.Extensions/Annotations/DataRowPopulateAttribute.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace BinaryDad.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows for a complex property to be populated via ToType().
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
|
||||
public sealed class DataRowPopulateAttribute : Attribute { }
|
||||
}
|
19
BinaryDad.Extensions/Annotations/EnumAliasAttribute.cs
Normal file
19
BinaryDad.Extensions/Annotations/EnumAliasAttribute.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BinaryDad.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows for additional metadata to be applied to Enum values
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
|
||||
public sealed class EnumAliasAttribute : Attribute
|
||||
{
|
||||
public IEnumerable<string> EnumAliasNames { get; private set; }
|
||||
|
||||
public EnumAliasAttribute(params string[] ids)
|
||||
{
|
||||
EnumAliasNames = ids;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user