Skip to content

vermilion/DapperEx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DapperEx

My improved version of great Dapper library https://github.com/StackExchange/dapper-dot-net

Usage:

public class DataAccess : DapperExProvider
{
    public DataAccess()
        : base("Data Source=localhost...")
    {
    }

    public IEnumerable<Data> Get()
    {
        return WithConnection(db =>
        {
            return db.Query<Data>("GetAll", null, commandType: CommandType.StoredProcedure);
        });
    }
}
        
  • Extended QueryMultiple mapper
    public async Task<IEnumerable<Data>> GetAllMappedAsync()
    {
        return await WithConnection(async db =>
        {
            using (var gridReader = await db.QueryMultipleAsync("GetAll"))
            {
                var result = gridReader
                    .StartMap(new DataMapper<Data>(x => x.Id)
                        .OneToOne<Status>((vp, r) => vp.Status = r, x => x.StatusId)
                    )
                    .NextMultiple(...) //And so on
                    .EndMap();

                return result;
            }
        });
    }    

About

My improved version of great Dapper library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages