You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.0 KiB
46 lines
2.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Apewer.Source
|
|
{
|
|
|
|
/// <summary>数据库引擎支持 ORM 访问。</summary>
|
|
public interface IOrm : IDatabase
|
|
{
|
|
|
|
/// <summary>初始化指定类型,以创建表或增加字段。</summary>
|
|
/// <param name="model">要初始化的类型。</param>
|
|
/// <returns>错误信息。当成功时候返回空字符串。</returns>
|
|
public string Initialize(Type model);
|
|
|
|
/// <summary>插入记录。</summary>
|
|
/// <param name="record">要插入的记录实体。</param>
|
|
/// <returns>错误信息。当成功时候返回空字符串。</returns>
|
|
public string Insert(Record record);
|
|
|
|
/// <summary>更新记录。</summary>
|
|
/// <param name="record">要插入的记录实体。</param>
|
|
/// <returns>错误信息。当成功时候返回空字符串。</returns>
|
|
public string Update(Record record);
|
|
|
|
/// <summary>获取指定类型的主键,按 Flag 属性筛选。</summary>
|
|
/// <param name="model">要查询的类型。</param>
|
|
/// <param name="flag">要求目标记录具有的 Flag 属性,当指定 0 时忽略此要求。</param>
|
|
public Result<List<string>> Keys(Type model, long flag = 0);
|
|
|
|
/// <summary>获取具有指定 Key 的记录,并要求记录具有指定的 Flag 属性。</summary>
|
|
/// <param name="key">目标记录的主键。</param>
|
|
/// <param name="flag">要求目标记录具有的 Flag 属性,当指定 0 时忽略此要求。</param>
|
|
public Result<T> Get<T>(string key, long flag = 0) where T : Record;
|
|
|
|
/// <summary>使用指定语句查询,获取查询结果。</summary>
|
|
public Result<List<T>> Query<T>(string sql) where T : Record;
|
|
|
|
/// <summary>查询所有记录。</summary>
|
|
/// <param name="flag">要求目标记录具有的 Flag 属性,当指定 0 时忽略此要求。</param>
|
|
public Result<List<T>> Query<T>(long flag = 0) where T : Record;
|
|
|
|
}
|
|
|
|
}
|
|
|