【发布时间】:2009-04-06 14:47:24
【问题描述】:
使用实体框架创建 DataLayer (DataLayer.dll) DataLayer.dll 包含数据对象。 我需要向“人”类添加一些业务逻辑。
是的,我知道,我可以使用部分类来添加业务逻辑。 但是在这种情况下(使用部分类)我们需要在 DataLayer.dll 中实现它!
我需要使用 BusinessLayer.dll
这样业务层就创建好了(BusinesLayer.dll)
在 BusinesLayer.dll 我们有文件 myPerson.cs
using DataLayer;
namespace Businesslayer
{
public class myPerson : DataLayer.Person
public Property String FullName()
{
get {return this.Firstname + " " + this.LastName}
}
}
其实我需要在网格中显示数据,像这样
var data=context.Person;
dataGridView1.dataSource = data;
是的,context.Person 返回一个 Person-Objects 列表 所以在网格中,列“全名”不可用
如何在 myPerson-Objects 上创建列表?
【问题讨论】:
标签: c# entity-framework