dapper-simplecrud

Dynamically build an object from a strongly typed class using C#?

你离开我真会死。 提交于 2020-01-07 08:09:22
问题 Currently, am adding the properties and values to the object manually like this example and sending to Dapper.SimpleCRUD to fetch data from Dapper Orm. This is the desired output I would like to achieve. object whereCriteria = null; whereCriteria = new { CountryId = 2, CountryName = "Anywhere on Earth", CountryCode = "AOE", IsActive = true }; The following class should build the object in the above mentioned format and return the ready-made object. public static class WhereClauseBuilder {

Getting The connection does not support MultipleActiveResultSets when using Dapper.SimpleCRUD in a forEach

余生长醉 提交于 2019-11-30 05:02:48
问题 I have the following code: var test = new FallEnvironmentalCondition[] { new FallEnvironmentalCondition {Id=40,FallId=3,EnvironmentalConditionId=1}, new FallEnvironmentalCondition {Id=41,FallId=3,EnvironmentalConditionId=2}, new FallEnvironmentalCondition {Id=42,FallId=3,EnvironmentalConditionId=3} }; test.ToList().ForEach(async x => await conn.UpdateAsync(x)); I am getting the InvalidOperationException: The connection does not support MultipleActiveResultSets I don't understand I am await