36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using FluentNHibernate.Conventions.Inspections;
|
|||
|
using System.Reflection;
|
|||
|
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;
|
|||
|
}
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|