部分类中的属性在项目绑定源中不可见! [英] Property in partial class is not visible in project binding sources !

查看:53
本文介绍了部分类中的属性在项目绑定源中不可见!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是ADO.NET实体框架的新手,我不知道如何做到这一点:

我有一个名为"POSUser"的数据库表;我想将它与Entity Framework一起使用,所以我使用Visual Studio来使用设计器工具生成Designer.cs中的映射和相关类。然后我设置了一个表单,一个网格和一个连接到POSUser类的绑定源(对象绑定)。它接缝工作正常,POSUser数据源显示所有属性。

下一步它将通过添加新属性自定义此生成的类:

public partial class POSUsers
{< br> public bool CanPerformDiscounts
{
get
{
return true;
}


................ .................

一切都很好,我可以在代码和linq查询中使用这个属性。

问题是我在我的网格上看不到这个新添加的属性。项目数据源不会显示它。
如何在我的对象绑定源和网格中显示此属性?


Well I'm new to ADO.NET Entity Framework and I don't know how to do this:

I have a single database table called "POSUser" and i want to use it with Entity Framework, so I've use the Visual Studio to
generate the mapings and the related classes in the Designer.cs using the designer tool. Then I've setup a form, a grid and a binding source connected to the POSUser class (object binding). It seams to work fine, the POSUser datasource shows all the properties.

The next step it will be customising this generated class by adding new property :

public partial class POSUsers
{
public bool CanPerformDiscounts
{
get
{
return true;
}
}
.................................

Everything builds nicely, I can use this property in code and in linq query.

The problem is that I can't see this new added property on my grid. The project datasource dosen't show it.
How can I make this property show in my object binding source and grid ?

推荐答案

我将你的CanPerformDiscounts部分属性添加到我的一个实体类中,我能够让它显示在实体和绑定的项目数据源中datagridview的。添加新的部分属性后是否刷新了项目数据源?此外,您是否可能使用Visual Studio 2008 SP1的预发布版本?在最终版本发布之前,对数据绑定进行了一些更改。

祝福,

Glenn Gailey [MSFT]

Glenn Gailey [MSFT]


这篇关于部分类中的属性在项目绑定源中不可见!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆