valueattribute.cs
来自「smark.data是基于C#开发的轻量级数据访问组件。 提供以下功能封: 」· CS 代码 · 共 41 行
CS
41 行
using System;
using System.Collections.Generic;
using System.Text;
namespace Smark.Data.Mappings
{
[AttributeUsage(AttributeTargets.Property)]
public abstract class ValueAttribute:Attribute
{
public ValueAttribute(bool afterupdate)
{
AfterByUpdate = afterupdate;
}
public bool AfterByUpdate
{
get;
set;
}
public virtual void Executing(IConnectinContext cc,object data,PropertyMapper pm,string table)
{
}
public virtual void Executed(IConnectinContext cc, object data, PropertyMapper pm, string table)
{
}
}
[AttributeUsage(AttributeTargets.Property)]
public class IDENTITY : ValueAttribute
{
public IDENTITY()
: base(true)
{
}
public override void Executed(IConnectinContext cc, object data, PropertyMapper pm, string table)
{
Command cmd = new Command("select @@IDENTITY ");
object value = cc.ExecuteScalar(cmd);
pm.Handler.Set(data,Convert.ChangeType( value,pm.Handler.Property.PropertyType));
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?