示例#1
0
        public async IAsyncEnumerable <TReturn> FindAsync <TData, TReturn>(Action <TData> model) where TReturn : new()
        {
            ToSql.SqlBuilder SqlBuilder = ToSql.Select.FromProperties <TData>();

            await foreach (TReturn item in Session.QueryAsync <TReturn>(SqlBuilder.ToString()))
            {
                yield return(item);
            }
        }
示例#2
0
        public async Task <TReturn> GetAsync <TData, TReturn>(TData model) where TReturn : new()
        {
            ToSql.SqlBuilder SqlBuilder = ToSql.Select.FromProperties <TData>();

            return(await Session.QueryFirstAsync <TReturn>(SqlBuilder.ToString()));
        }
示例#3
0
 public async Task <TData> GetAsync <TData, TId>(TId id) where TData : class, new() where TId : struct
 {
     ToSql.SqlBuilder SqlBuilder = ToSql.Select.FromProperties <TData>();
     return(await Session.QueryFirstAsync <TData>(SqlBuilder.ToString()));
 }