Exemplo n.º 1
0
        public async Task <int> DeleteAsync(T entity)
        {
            string statement = MssqlQueryBuilder.BuildSingleUpdateStatement <T>();
            var    result    = await ExecuteAsync(statement, entity);

            return(result);
        }
Exemplo n.º 2
0
        public async Task <int> PutAsync(T entity)
        {
            string statement = MssqlQueryBuilder.BuildSinglePutStatement <T>();
            int    result    = await ExecuteAsync(statement, entity);

            return(result);
        }
Exemplo n.º 3
0
        public async Task <IEnumerable <T> > FindAsync(object condition)
        {
            string statement = MssqlQueryBuilder.BuildSelectStatement <T>(condition);
            var    result    = await QueryAsync <T>(statement, condition);

            return(result);
        }
Exemplo n.º 4
0
        public async Task <int> InsertAsync(T entity)
        {
            string statement = MssqlQueryBuilder.BuildInsertStatement <T>();
            var    result    = await ExecuteAsync(statement, entity);

            return(result);
        }
Exemplo n.º 5
0
        public int Put(T entity)
        {
            string statement = MssqlQueryBuilder.BuildSinglePutStatement <T>();
            int    result    = Execute(statement, entity);

            return(result);
        }
Exemplo n.º 6
0
        public int Update(T entity)
        {
            string statement = MssqlQueryBuilder.BuildSingleUpdateStatement <T>();
            var    result    = Execute(statement, entity);

            return(result);
        }
Exemplo n.º 7
0
        public async Task <T> GetFirstAsync(object condition)
        {
            string statement = MssqlQueryBuilder.BuildSelectStatement <T>(condition);
            var    result    = await QueryAsync <T>(statement, condition);

            if (result.Any())
            {
                return(result.ElementAt(0));
            }
            return(null);
        }
Exemplo n.º 8
0
        public T GetFirst(object condition)
        {
            string statement = MssqlQueryBuilder.BuildSelectStatement <T>(condition);
            var    result    = Query <T>(statement, condition);

            if (result.Any())
            {
                return(result.ElementAt(0));
            }
            return(null);
        }
Exemplo n.º 9
0
 public IEnumerable <T> Find(object condition)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         connection.Open();
         string statement = MssqlQueryBuilder.BuildSelectStatement <T>(condition);
         var    result    = connection.Query <T>(statement, condition);
         connection.Close();
         return(result);
     }
 }