XolidQuery 1.0.3

Dapper XML Query Mapper Plugin! Likes iBatis(MyBatis)

Install-Package XolidQuery -Version 1.0.3
dotnet add package XolidQuery --version 1.0.3
<PackageReference Include="XolidQuery" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XolidQuery --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

XolidQuery

Dapper XML Query Mapper Plugin! Likes iBatis(MyBatis)

  • 1.0.3 Updated : Bugs fix. and property names are ignore case.
  • 1.0.2 Updated : isNull, isNullOrEmpty tags added.

Usage

using only Dapper
using (var conn = Connection)
{
	conn.Query<User>("SELECT id, email, name, age, phone, reg_date AS regDate FROM user WHERE name LIKE CONCAT('%', @name, '%')", new {name = "Smith"});
}
using XolidQuery with Dapper
Repository

UserRepository.cs

using (var conn = Connection)
{
  users = (List<User>) conn.XQuery<User>("User.findAll", user);
}
Map

User.xml

<?xml version="1.0" encoding="utf-8"?>
<mapper>
    <sql id="selectColumns">
        id,
        email,
        name,
        age,        
        phone,
        reg_date AS regDate
    </sql>
    
    <select id="findAll">
        SELECT
            <include refid="selectColumns" />
        FROM user
        <where>
            <isNotNull property="name">
                name LIKE CONCAT('%', @name, '%')
            </isNotNull>
            <isNotNull property="email">
                AND email LIKE CONCAT('%', @email, '%')
            </isNotNull>
            <isNotNull property="age">
                AND age = @age
            </isNotNull>
            <isNotNull property="phone">
                AND phone LIKE CONCAT('%', @phone, '%')
            </isNotNull>
        </where>
        ORDER BY id DESC
    </select>
</mapper>

Supported Tag List (Likes MyBatis)

  • select, insert, update, delete
  • isNotNull, isNull 1.0.2, isNullOrEmpty 1.0.2
  • if
  • choose, when, otherwise
  • include

XolidQuery

Dapper XML Query Mapper Plugin! Likes iBatis(MyBatis)

  • 1.0.3 Updated : Bugs fix. and property names are ignore case.
  • 1.0.2 Updated : isNull, isNullOrEmpty tags added.

Usage

using only Dapper
using (var conn = Connection)
{
	conn.Query<User>("SELECT id, email, name, age, phone, reg_date AS regDate FROM user WHERE name LIKE CONCAT('%', @name, '%')", new {name = "Smith"});
}
using XolidQuery with Dapper
Repository

UserRepository.cs

using (var conn = Connection)
{
  users = (List<User>) conn.XQuery<User>("User.findAll", user);
}
Map

User.xml

<?xml version="1.0" encoding="utf-8"?>
<mapper>
    <sql id="selectColumns">
        id,
        email,
        name,
        age,        
        phone,
        reg_date AS regDate
    </sql>
    
    <select id="findAll">
        SELECT
            <include refid="selectColumns" />
        FROM user
        <where>
            <isNotNull property="name">
                name LIKE CONCAT('%', @name, '%')
            </isNotNull>
            <isNotNull property="email">
                AND email LIKE CONCAT('%', @email, '%')
            </isNotNull>
            <isNotNull property="age">
                AND age = @age
            </isNotNull>
            <isNotNull property="phone">
                AND phone LIKE CONCAT('%', @phone, '%')
            </isNotNull>
        </where>
        ORDER BY id DESC
    </select>
</mapper>

Supported Tag List (Likes MyBatis)

  • select, insert, update, delete
  • isNotNull, isNull 1.0.2, isNullOrEmpty 1.0.2
  • if
  • choose, when, otherwise
  • include

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.3 74 7/5/2019