Skip to content

Commit

Permalink
添加需要特性
Browse files Browse the repository at this point in the history
  • Loading branch information
Kation committed Sep 29, 2017
1 parent 6c13e0e commit 58df663
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Wodsoft.ComBoost.Core/OptionRequiredAttribute.cs
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Wodsoft.ComBoost
{
/// <summary>
/// 用于标注领域方法需要的选项。
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
public class OptionRequiredAttribute : Attribute
{
/// <summary>
/// 领域方法需要的服务类型。
/// </summary>
/// <param name="type"></param>
public OptionRequiredAttribute(Type type)
{
Type = type;
}

/// <summary>
/// 获取值类型。
/// </summary>
public Type Type { get; private set; }
}
}
27 changes: 27 additions & 0 deletions src/Wodsoft.ComBoost.Core/ServiceRequiredAttribute.cs
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Wodsoft.ComBoost
{
/// <summary>
/// 用于标注领域方法需要的服务。
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
public class ServiceRequiredAttribute : Attribute
{
/// <summary>
/// 领域方法需要的服务类型。
/// </summary>
/// <param name="type"></param>
public ServiceRequiredAttribute(Type type)
{
Type = type;
}

/// <summary>
/// 获取值类型。
/// </summary>
public Type Type { get; private set; }
}
}
43 changes: 43 additions & 0 deletions src/Wodsoft.ComBoost.Core/ValueRequiredAttribute.cs
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Wodsoft.ComBoost
{
/// <summary>
/// 用于标注领域方法需要的值。
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
public class ValueRequiredAttribute : Attribute
{
/// <summary>
/// 领域方法需要的值名称。
/// </summary>
/// <param name="name">值名称。</param>
public ValueRequiredAttribute(string name)
{
Name = name;
}

/// <summary>
/// 领域方法需要的值名称与类型。
/// </summary>
/// <param name="type"></param>
/// <param name="name">值名称。</param>
public ValueRequiredAttribute(Type type, string name)
: this(name)
{
Type = type;
}

/// <summary>
/// 获取值名称。
/// </summary>
public string Name { get; private set; }

/// <summary>
/// 获取值类型。
/// </summary>
public Type Type { get; private set; }
}
}

0 comments on commit 58df663

Please sign in to comment.