コード例 #1
0
        public void SelectMethod()
        {
            DataCore <Income> db  = new DataCore <Income>(new SqlConnection(@"Server=Localhost\SQL2019;Database=FinanceManager;User Id=sa;Password=pass123;"));
            Income            obj = db.ExecuteQuery("SELECT * FROM Incomes WHERE Id = @Id", new { Id = 1 }).FirstOrDefault();

            Assert.IsTrue(obj != null);
        }
コード例 #2
0
        public void CommandMethod()
        {
            DataCore <Income> db = new DataCore <Income>(new SqlConnection(@"Server=Localhost\SQL2019;Database=FinanceManager;User Id=sa;Password=pass123;"));

            db.ExecuteCommand("UPDATE Incomes SET Description = @Desc WHERE Id = @Id", new { Desc = "Test", Id = 1 });

            Income obj = db.ExecuteQuery("SELECT * FROM Incomes WHERE Id = @Id", new { Id = 1 }).FirstOrDefault();

            Assert.IsTrue(obj.Description == "Test");
        }
コード例 #3
0
 override public bool Test(DataCore dataCore)
 {
     dataCore.ExecuteQuery(query);
     return(true);
 }