-
Notifications
You must be signed in to change notification settings - Fork 588
Description
I have a Generic GetItem method
public static T GetItem(string server, int Id) where T : class
{
using (var conn = GlobalConnection.GetServerDBConnection(server, db))
{
return conn.Get(Id);
}
}
Since updating to the latest version, 1.7, I am getting the following Linq error
Sequence contains more than one element - at System.Linq.ThrowHelper.ThrowMoreThanOneElementException() at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source) at DapperExtensions.DapperImplementor.InternalGet[T](IDbConnection connection, Object id, IDbTransaction transaction, Nullable1 commandTimeout, IList1 colsToSelect, IList1 includedProperties) at System.Dynamic.UpdateDelegates.UpdateAndExecute7[T0,T1,T2,T3,T4,T5,T6,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) at DapperExtensions.DapperImplementor.Get[T](IDbConnection connection, Object id, IDbTransaction transaction, Nullable1 commandTimeout, IList1 includedProperties) at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) at DapperExtensions.DapperExtensions.Get[T](IDbConnection connection, Object id, IDbTransaction transaction, Nullable`1 commandTimeout) at Cardinal.Global.DataAccess.GenericDb.GetItem[T](String server, Int32 Id)
This uses a mapped class but has been working ok on previous versions
public class ApplicationMapping : ClassMapper
{
public ApplicationMapping()
{
Table("gbl_Application");
Map(f => f.ApplicationId).Column("id").Key(KeyType.Identity);
Map(f => f.Name).Column("name");
Map(f => f.Description).Column("description");
Map(f => f.Prefix).Column("_prefix");
}
}