Visual Studio 不会更新我的数据源的属性
我正在使用我的“发票”类作为数据源。但在向其添加更多属性后,Visual Studio 拒绝刷新数据源,并且我在数据源中找不到新属性。
尝试重新启动项目,再次删除对象并将其添加为数据源。没有工作。
I am using my class "Invoice" as a Data Source. But after adding more properties to it, Visual Studio refuses to refresh the data source and I can't find the new properties in my data source.
Tried restarting project, deleting and adding object as datasource again. Did not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
问题是 Intellisense 由于数据源的更改而过时。
解决方案就是简单地重建项目。
Problem was Intellisense going out of date due to changes in the Data Source.
Solution was to simply to rebuild the project.
您使用任何源代码管理吗?另外,在
Properties
文件夹下创建.datasource
文件,尝试通过打开Data Sources
选项卡删除并重新添加该对象。此外,发票中的新属性应该具有访问修饰符(至少
{ get;}
),否则它可能不会显示 AFAIK。Are you using any source control ? also,
.datasource
file gets created underProperties
folder, try to remove and re-add the object by openingData Sources
tab.also your new properties in Invoice should have access modifiers (at least
{ get;}
) otherwise it might not show up AFAIK.OMGKurtNilsen 是对的:
您不需要删除并重新创建数据源 - 重建项目即可!
我使用 VS 2010 项目中的数据源对其进行了测试,该项目从一个简单的数据源中获取数据C# 对象。
OMGKurtNilsen is right:
You don't need to delete and re-create the datasource - a project rebuild will do!
I tested it with a datasource in a VS 2010 project, that takes its data from a simple C# object.
这个问题发生在使用数据源对象的报表设计器中,当我在类中添加或删除属性并刷新报表数据源上的数据面板中的数据源时,这不会显示最后的更改。我解决了添加对 Microsoft.CShart 程序集的引用。你可以尝试这个来解决你的问题。
That problem ocurrs in report designer where use data source object, when i add or remove a property in my class and i refresh the data source in data panel on report data sources, this don't show last changes. I resolved adding reference to Microsoft.CShart assembly. You could try this to resolve you problem.
如果您将数据源和表单元素保存在不同的类库中,有时您必须重建类库,这种情况大多发生在引用以静态方式绑定时。
If you keep your datasource and your form element in different class libraries, sometimes you have to rebuild your class libraries, this situation mostly occurs when the reference bound with static way.
这是你应该做的。
刷新数据源,删除实体并在更改之前将其添加回来。
This what you should do.
Refresh the Data Source, Remove the entity and Add it back in before it would change.