1.初始化单个实体类

ActiveRecordStarter.Initialize( source, typeof(User) );

  

2.初始化多个实体类

   

1.
ActiveRecordStarter.Initialize( source, typeof(Order),typeof(Product));
2
IConfigurationSource source = System.Configuration.ConfigurationManager.GetSection("activerecord") as     IConfigurationSource; 

Type[] paramTypes
= new Type[3];
paramTypes[
0] = typeof(User1);
paramTypes[
1] = typeof(Post);
paramTypes[
2] = typeof(Blog);
ActiveRecordStarter.Initialize(source, paramTypes);
3
Assembly assembly = Assembly.Load("ARTest"); 
ActiveRecordStarter.Initialize(assembly, source);

 

 

  4.

// 获取数据库连接配置
XmlConfigurationSource source = new XmlConfigurationSource(@"Config\ActiveRecord.xml");

// 载入程序集中所有 ActiveRecord 类。
ActiveRecordStarter.Initialize(Assembly.GetExecutingAssembly(), source);

// 这样可以一次初始化所有的程序集里面的类。

  

相关文章:

  • 2021-06-15
  • 2021-09-29
  • 2022-12-23
  • 2022-03-02
  • 2022-03-04
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-01
  • 2022-02-14
  • 2021-11-24
  • 2021-06-29
  • 2022-12-23
  • 2021-12-23
  • 2021-10-03
相关资源
相似解决方案