当定义完关系映射后,必须把关系映射的定义注册到DbConfiguration中,否则关系映射将不起作用。

代码如下:

 

        const string connectionStringName = "Northwind";

        static DbConfiguration dbConfiguration = DbConfiguration
                .Configure(connectionStringName)
                .SetSqlLogger(() => new SqlLog(Console.Out))//设置输出日志
                .AddClass<Customer>()//注册映射
                .AddClass<Order>()//注册映射
                .AddClass<OrderDetail>()//注册映射
                .AddClass<Product>();//注册映射

 

 

Last edited Nov 19, 2012 at 2:19 AM by qswang, version 1

Comments

No comments yet.