init
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
|
||||
using System;
|
||||
|
||||
namespace DTS.Storage
|
||||
{
|
||||
public class DbTypeAttr : Attribute
|
||||
{
|
||||
public string DbType { get; private set; }
|
||||
internal DbTypeAttr(string attr)
|
||||
{
|
||||
DbType = attr;
|
||||
}
|
||||
public static string GetDbType(object o)
|
||||
{
|
||||
if (o != null)
|
||||
{
|
||||
System.Reflection.MemberInfo[] mi = o.GetType().GetMember(o.ToString());
|
||||
if (mi != null && mi.Length > 0)
|
||||
{
|
||||
DbTypeAttr attr = Attribute.GetCustomAttribute(mi[0], typeof(DbTypeAttr)) as DbTypeAttr;
|
||||
if (null != attr)
|
||||
{
|
||||
return attr.DbType;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user