vendredi 22 mars 2019

How to return List

Please i wanna keep this question answer itself. don't bother by adding modifications

Hello, Dapper ORM is very fast and light-weight database mapper. so people use it as a replace of slowly entity framework or old plain ADO.NET.

I asked this question and answer it, many developers really carious about return a real-time List from Dapper.NET ORM that can bindable to grid. rather than current repository that only returns List<DapperRow> which is useless for binding things.

Problems of current Dapper.NET repository ( Speaking about dynamic things )

  1. List<dynamic> dynamicList = IConn.Query(queryString); returns DapperRow
  2. The List<DapperRow> is useless for those who know dynamic things specially who cares about filling GridViews & TreeLists
  3. Library itself is hand or wanna say hard-coded one. contains list of OPCodes ( MSIL injections ) so many developers feel a pain when need to enhance or develop customization dynamic things.

After taking much time on this things. and with some helpful from other contributors. I created this class file that help developers to binding dynamically with high performance. SqlMapper.Dynamics.cs Link Provided

Actually the effecient and speed of dynamics is give very high performance over strongly typed list.

List<dynamic> Dapper ORM with SqlMapper.Dynamics.cs Hit 55 - 65 ms

List<StronglyTypedClass> Hit 72 - 73 ms

6,000 Records test with Intel Xeon 6,000 Records test with Intel Xeon

SqlMapper.Dynamics.cs Link Here

Usage :

  1. You must use this unit / class with current Dapper repository source code Github Link

  2. Compile your repository with SqlMapper.Dynamics.cs, add file to Dapper folder.

  3. Then just use the new extension-method QueryDynamic(string yourQuery)

    IDbConnection db = new SqlConnection("server=(local); database = test");
    string query = "SELECT * FROM Table";
    dynamic BindingList = db.QueryDynamic(query);
    gridControl1.DataSource = BindingList;
    
    

Please, don't modify or answer this question. feel free to close it. As i just help developers who use Dapper.NET ORM library with Dynamic bindings things ( GridViews, TreeLists, etc.. )





Aucun commentaire:

Enregistrer un commentaire