public int Insert(Employee emp)
        {
            String sql = "insert into employees(emp_id, name, gender, email, phone_number, city) " +
                         "values(@emp_id,@name,@gender,@email,@phone_number,@city)";

            return(db.Execute(sql, emp));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            DapperHelper dapperHelper = new DapperHelper(sqlConnectionString, DapperHelper.Providers.SqlServer);
            Users        users        = new Users {
                ID = 3, Name = "test", Age = 32, Sex = "男"
            };

            dapperHelper.Execute(DapperHelper.CompileInsert <Users>(new Users()), users);
            IEnumerable <Users> list = dapperHelper.Query <Users>("select * from Users", null);
        }