1.编写SpringBoot的引导类 package springboot_test.springboot_test; import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.context.properties.EnableConfigurationPr…
一.事务 我们在大家学到这,或多或少对事务都有一些理解了.今天的我也对事务有了更深一层的理解对我来说,我想与大家一起分享一下. 解析: 1.ADO.NET提供了事务处理功能 2.C#中开启事务 3.在咱们的SQL后台就不用开启事务了 4.eg.我要在FrmSW的窗体上添加年级,我们首先在数据库中在年级表中对其GradeName设置唯一约束,如果GradeName重复则事务会将其回滚,如GradeName不重复就会输出. string str = "data source=.;initial ca…
public class User: private string _User; public string User1 { get { return _User; } set { _User = value; } } private string _Password; public string Password { get { return _Password; } set { _Password = value; } } } } User u; private void Button_Cl…
后台代码: private void bindnewslist() { long num = 100L; List<Model.news> news = _news.GetList(out num); this.newslist.DataSource = news; this.newslist.DataBind(); } 说明:Model.news是实体类,GetList(out long)方法返回List<Model.news>. 前台代码: <ul class="…
dao层的代码: public interface SupplierMapper extends BaseMapper<SupplierDbo>{ /*List<SupplierDbo> getAllSupplier(@Param("type") String type, @Param("cooperStatus") Integer cooperStatus, @Param("name") String name, @Pa…
public static void testReflect(Object model) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{ Field[] field = model.getClass().getDeclaredFields(); //获取实体类的所有属性,返回Field数组 for(int j=0 ; j<field…
list<实体类>嵌套list<实体类>,必须保证嵌套的实体类里面有这个list对象,把这个list<实体类>当做一个对象 这是需要解析的数据,并把这些数据封装成list<实体类>对象,传给前台 <root> <RETURN_CODE>0</RETURN_CODE> <RETURN_DESC>成功!</RETURN_DESC> <RETURN_INFO> <order_info&g…
id:在命名空间中唯一的标识符,可以被用来引用这条语句. parameterType:设置传入这条语句的参数的数据类型,如int,String...... resultType:设置从这条语句中返回数据的类型. 注意如果返回的是集合,那应该设置为集合包含的类型,而不是集合本身.可以使用 resultType 或 resultMap,但不能同时使用. select 1)查询某个表的所有记录 <select id="queryall" resultType="com.tes…
using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; namespace WebHub { public abstract class HubContext<DB, T> where DB : DbContext, new() where T : class { public static void Remove(object idOrObj) { using (…
using System.Reflection; Type t = obj.GetType();//获得该类的Type foreach (PropertyInfo pi in t.GetProperties()){ var name = pi.Name;//获得属性的名字,后面就可以根据名字判断来进行些自己想要的操作 var value = pi.GetValue(obj, null);//用pi.GetValue获得值 var type = value?.GetType() ?? typeof…