日期:2014-05-17 浏览次数:20445 次
public class Post{ public Member author }
/* 此对象由数据设计工具生成 */ using System; using System.Collections; using System.Collections.Generic; using Ufida.T.EAP.Domains; using Ufida.T.EAP.Domains.Test; namespace Ufida.T.EAP.Domains.Test { partial class Post { private object iDAuthor; /// <summary> /// iDAuthor /// </summary> public object IDAuthor { get { return iDAuthor; } set { iDAuthor = value; } } private Member author; /// <summary> /// Member 关联关系对象 /// </summary> public Member Author { get { return author; } set { author = value; } } } }
------解决方案--------------------
AuthorID和author(实体)分别作为Member实体的两个属性
在author的Get里面对Author赋值,先判断this.AuthorID有没有值,有值就取出来给Author的赋值,没有就给赋null值
------解决方案--------------------
get 滴时候查询,晚加载。set早加载有点浪费
为了保证查询效率,逻辑内部需要维护一个db的视图。
不然每次get都重新执行一条sql语句都太不划算了