예제 #1
0
        public static Task <IEnumerable <EventContract> > Select(
            IDbConfig dbConfig,
            IDbConnection dbConnection,
            Guid[] ids)
        {
            var sql = dbConfig.BuildSql(ids, out var @params);

            return(dbConnection.QueryAsync <EventContract>(sql, @params));
        }
예제 #2
0
        public async static Task <IEnumerable <Person> > Execute(
            IDbConnection dbConnection,
            IDbConfig dbConfig,
            Guid[] ids)
        {
            var sql = dbConfig.BuildSql(ids, out var @params);
            var res = await dbConnection.QueryAsync <Person>(sql, @params);

            return(res);
        }
예제 #3
0
        public static Task <Person> Execute(
            IDbConnection dbConnection,
            IDbConfig dbConfig,
            Guid id)
        {
            var sql     = dbConfig.BuildSql();
            var @params = new DynamicParameters();

            @params.Add(nameof(Person.Id), dbConfig.CreateParameterResolver().WithGuidParameterValue(id));
            return(dbConnection.QuerySingleAsync <Person>(sql, @params));
        }
예제 #4
0
        public static Task Execute(
            IDbConfig dbConfig,
            IDbConnection dbConnection,
            Guid id)
        {
            var @params = new DynamicParameters();

            @params.Add(Columns.Id, dbConfig.CreateParameterResolver().WithGuidParameterValue(id));
            var sql = dbConfig.BuildSql();

            return(dbConnection.ExecuteAsync(sql, @params));
        }
예제 #5
0
        public static Task Execute(
            IDbConfig dbConfig,
            IDbConnection dbConnection,
            EventContract eventContract)
        {
            var @params = new DynamicParameters();

            @params.Add(Columns.Id, dbConfig.CreateParameterResolver().WithGuidParameterValue(eventContract.Id));
            @params.Add(Columns.Event, eventContract.Event);
            @params.Add(Columns.Stop, dbConfig.CreateParameterResolver().WithBooleanParameterValue(eventContract.Stop));
            var sql = dbConfig.BuildSql();

            return(dbConnection.ExecuteAsync(sql, @params));
        }
예제 #6
0
        public async static Task Execute(
            IDbConnection dbConnection,
            IDbConfig dbConfig,
            Person person)
        {
            var sql     = dbConfig.BuildSql();
            var @params = new DynamicParameters();

            @params.Add(nameof(Person.Id), dbConfig.CreateParameterResolver().WithGuidParameterValue(person.Id));
            @params.Add(nameof(Person.Alive), dbConfig.CreateParameterResolver().WithBooleanParameterValue(person.Alive));
            @params.Add(nameof(Person.Username), person.Username);
            @params.Add(nameof(Person.Password), person.Password);
            await dbConnection.ExecuteAsync(sql, @params);
        }