コード例 #1
0
        public bool Sil <T>(int ID)
        {
            SqlCommand komut = new SqlCommand(string.Format("{0}_Delete", typeof(T).Name), Araclar.Baglanti);

            komut.CommandType = CommandType.StoredProcedure;
            komut.Parameters.AddWithValue("@ID", ID);
            return(Araclar.Calıstır(komut));
        }
コード例 #2
0
        public bool Ekle <T>(T entity)
        {
            SqlCommand komut = new SqlCommand(string.Format("{0}_Insert", typeof(T).Name), Araclar.Baglanti);

            komut.CommandType = CommandType.StoredProcedure;
            PropertyInfo[] proplar = typeof(T).GetProperties();
            foreach (PropertyInfo p in proplar)
            {
                string ad    = p.Name;
                object deger = p.GetValue(entity);
                komut.Parameters.AddWithValue("@" + ad, deger);
            }
            return(Araclar.Calıstır(komut));
        }