public async ValueTask <IEnumerable <object> > GetAllAsync(EntityType entityType) { Type type = EntityTypeLoader.Get(entityType); MethodInfo methodInfo = GetGenericMethodInfoFromSqlMapper("GetAllAsync", type); dynamic result = methodInfo.Invoke(null, new[] { _connection, null, null }) !; return(((await result)as IEnumerable <object>) !); }
public async ValueTask <object> GetByIdAsync(dynamic id, EntityType entityType) { Type type = EntityTypeLoader.Get(entityType); MethodInfo methodInfo = GetGenericMethodInfoFromSqlMapper("GetAsync", type); dynamic result = methodInfo.Invoke(null, new object?[] { _connection, id, null, null }) !; return(await result); }
public async ValueTask <bool> DeleteAsync(JsonElement entity, EntityType entityType, IDbTransaction?transaction = null) { Type type = EntityTypeLoader.Get(entityType); MethodInfo methodInfo = GetGenericMethodInfoFromSqlMapper("DeleteAsync", type); object tentity = await DeserializeJsonElementAsync(entity, type); dynamic result = methodInfo.Invoke(null, new[] { _connection, tentity, transaction, null }) !; return(await result); }
public async ValueTask <int> PostManyAsync(JsonElement entities, EntityType entityType, IDbTransaction?transaction = null) { Type type = EntityTypeLoader.Get(entityType); Type arrayType = type.MakeArrayType(); MethodInfo methodInfo = GetGenericMethodInfoFromSqlMapper("InsertAsync", arrayType); object tentities = await DeserializeJsonElementAsync(entities, arrayType); dynamic result = methodInfo.Invoke(null, new[] { _connection, tentities, transaction, null, null }) !; return(await result); }