public bool Equals(UserId c1) { if (c1 == null) { return false; } return this.ToString() == c1.ToString(); }
public static void ContribSelectData(UserId id) { using (var connection = new System.Data.SQLite.SQLiteConnection(cnStr)) { connection.Open(); var data = connection.Get<Poco.Users>(id); System.Diagnostics.Debug.Assert(id.Equals(data.Id)); } }
public static void SelectData(UserId id) { using (var connection = new System.Data.SQLite.SQLiteConnection(cnStr)) { connection.Open(); var data = connection.Query<Poco.Users>("SELECT * FROM Users WHERE Id = @Id", new { Id = id }).FirstOrDefault(); System.Diagnostics.Debug.Assert(id.Equals(data.Id)); } }
private static UserId InsertData() { var id = new UserId("Abc12c"); using (var connection = new System.Data.SQLite.SQLiteConnection(cnStr)) { connection.Open(); connection.Execute("INSERT INTO Users (Id, Age, Name) VALUES (@Id, @Age, @Name)", new { Age = 31, Id = id, Name = "Peter Gill" }); } return id; }
private static UserId ContribInsertData() { var id = new UserId("Abc12c"); using (var connection = new System.Data.SQLite.SQLiteConnection(cnStr)) { connection.Open(); connection.Insert(new Poco.Users() { Age = 31, Id = id, Name = "Peter Gill" }); } return id; }