Form1.cs 794 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace SqliteEFDemo
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. private void button1_Click(object sender, EventArgs e)
  19. {
  20. using (SQLiteContext context=new SQLiteContext())
  21. {
  22. Person people = new Person()
  23. {
  24. FirstName = "Hello",
  25. LastName = "World"
  26. };
  27. context.Persons.Add(people);
  28. context.SaveChanges();
  29. }
  30. }
  31. }
  32. }