When using the multi-mapping APIs ensure you set the splitOn param if you have keys other than Id“, ”splitOn with Multiple relations
<p>I get the following exception when i try to execute this method :</p>

<blockquote>
  <p>When using the multi-mapping APIs ensure you set the splitOn param if
  you have keys other than Id“</p>
</blockquote>

<hr>

<pre><code>public static IEnumerable&lt;FinancePositionList&gt; GetFinancialListsForConsecutiveYears(int year, int periodTypeId, int period)
        {
            IEnumerable&lt;FinancePositionList&gt; resultList;
            using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Finance"].ConnectionString))
            {
                conn.Open();
                StringBuilder query = new StringBuilder();
                query.Append("SELECT b.CompanyId,b.CompanyName,[Year]");
                query.Append(",CreationDate,AccruedExpenses,AdvancePaymentsToContractors");


                query.Append("FROM finance.FinanceList a INNER JOIN finance.Company b ");
                query.Append("ON a.CompanyId = b.CompanyId ");
                query.Append("INNER JOIN finance.ListPeriod c ");
                query.Append("ON c.FinanceListId = a.FinanceListId ");
                query.Append("WHERE Discriminator = " + "'" + "FinancePositionList" + "' ");
                query.Append("AND[Year] IN @years ");
                query.Append("AND c.PeriodTypeId = @PeriodTypeId AND c.Period = @Period ");
                query.Append("ORDER BY b.CompanyId, a.[Year] DESC ");

                resultList = conn.Query&lt;FinancePositionList, Company,ListPeriod, FinancePositionList&gt;(query.ToString(),
                   (a, b,c) =&gt;
                   {
                       a.Company = b;
                       c.FinanceList = a;
                       return a;
                   },
                  new
                  {
                      years = new[] { year, year - 1 },
                      PeriodTypeId = periodTypeId,
                      Period = period
                  },
                    splitOn: "CompanyId,FinanceListId").AsEnumerable();
            }
            return resultList;
        }
</code></pre>

<hr>

<p><a href="https://i.stack.imgur.com/tzSj2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tzSj2.png" alt="enter image description here"></a></p>

<hr>

<p><strong>EDIT :</strong></p>

<p>I fix the problem now by changing the order of columns like this :
But I wonder if there are more enhancement to the code could i do ?</p>

<pre><code> public static IEnumerable&lt;FinancePositionList&gt; GetFinancialListsForConsecutiveYears(int year, int periodTypeId, int period)
        {
            IEnumerable&lt;FinancePositionList&gt; resultList;
            using (var conn = new SqlConnection(ResolveConnectionString()))
            {
                conn.Open();
                StringBuilder query = new StringBuilder();
                query.Append("SELECT CreationDate,AccruedExpenses,AdvancePaymentsToContractors,[Year]");
                query.Append(",b.CompanyId,b.CompanyName,c.FinanceListId ");
                query.Append("FROM finance.FinanceList a INNER JOIN finance.Company b ");
                query.Append("ON a.CompanyId = b.CompanyId ");
                query.Append("INNER JOIN finance.ListPeriod c ");
                query.Append("ON c.FinanceListId = a.FinanceListId ");
                query.Append("WHERE Discriminator = " + "'" + "FinancePositionList" + "' ");
                query.Append("AND [Year] IN @years ");
                query.Append("AND c.PeriodTypeId = @PeriodTypeId AND c.Period = @Period ");
                query.Append("ORDER BY b.CompanyId, a.[Year] DESC ");

                resultList = conn.Query&lt;FinancePositionList, Company, ListPeriod, FinancePositionList&gt;(query.ToString(),
                   (a, b, c) =&gt;
                   {
                       a.Company = b;
                       a.CompanyId = b.CompanyId;
                       a.FinanceListId = c.FinanceListId;
                       return a;
                   },
                  new
                  {
                      years = new[] { year, year - 1 },
                      PeriodTypeId = periodTypeId,
                      Period = period
                  },
                    splitOn: "CompanyId,FinanceListId").AsEnumerable();
            }
            return resultList;
        }
</code></pre>