2011-06-29 20:27:07 +00:00
|
|
|
|
using System.Reflection;
|
2011-02-18 16:54:48 +00:00
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.SqlDAO
|
|
|
|
|
{
|
|
|
|
|
public static class AttributeChecker
|
|
|
|
|
{
|
|
|
|
|
public static bool Cascade(ICustomAttributeProvider provider)
|
|
|
|
|
{
|
|
|
|
|
return provider.GetCustomAttributes(typeof(CascadeAttribute), false).Length == 1;
|
|
|
|
|
}
|
2011-06-23 12:47:48 +00:00
|
|
|
|
public static bool Inverse(ICustomAttributeProvider provider)
|
|
|
|
|
{
|
|
|
|
|
return provider.GetCustomAttributes(typeof(InverseAttribute), false).Length == 1;
|
|
|
|
|
}
|
2011-02-18 16:54:48 +00:00
|
|
|
|
public static bool Unique(ICustomAttributeProvider provider)
|
|
|
|
|
{
|
|
|
|
|
return provider.GetCustomAttributes(typeof(UniqueAttribute), false).Length == 1;
|
|
|
|
|
}
|
|
|
|
|
public static bool NotNull(ICustomAttributeProvider provider)
|
|
|
|
|
{
|
|
|
|
|
return provider.GetCustomAttributes(typeof(NotNullAttribute), false).Length == 1;
|
|
|
|
|
}
|
|
|
|
|
public static bool Formula(ICustomAttributeProvider provider)
|
|
|
|
|
{
|
|
|
|
|
return provider.GetCustomAttributes(typeof(FormulaAttribute), false).Length == 1;
|
|
|
|
|
}
|
|
|
|
|
public static string GetFormula(ICustomAttributeProvider provider)
|
|
|
|
|
{
|
|
|
|
|
var vv = (FormulaAttribute)provider.GetCustomAttributes(typeof(FormulaAttribute), false)[0];
|
|
|
|
|
return vv.Formula;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|