예제 #1
0
        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>) !);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }