动态数据实体ID列可见假的? [英] Dynamic Data Entities ID Column visible false?
问题描述
有两种模板在asp.net 3.5
There are Two kind of template in asp.net 3.5
1)动态数据Web应用程序。
1) Dynamic Data Web App.
2)动态数据Web应用程序。实体
2) Dynamic Data Web App. Entities
我的SQL数据库得到了客户表;列:ID,姓名,姓VS
My SQL database has got Customer Table ; Columns : ID, Name,Surname vs.
如果你使用的第一个(动态数据Web应用程序);你无法看到ID列(Customer表)(LINQ到SQL)
if you use first one(Dynamic Data Web App); you can not see ID column(Customer Table) (Linq to Sql)
但是,如果你使用第二个(动态数据Web应用程序,实体),你可以看到ID列
But if you use second one(Dynamic Data Web App. Entities), you can see ID column
如何过滤柱尤其ID区域。我是说;我需要ID列的visible = false
How can i filter column especially ID area. I mean; i need ID column visible =false
推荐答案
在你的元数据类,将ID设置为以下内容:
In your metadata class, set the Id to the following:
[ScaffoldColumn(false)]
public object Id { get; set; }
如果你没有一个参考元数据类,可以通过添加属性到局部类添加这个,是这样的:
In case you don't have a reference to the metadata class, you add this by adding the attribute to the partial class, something like this:
[MetadataType(typeof(MyEntityFromTable_MD))]
public partial class MyEntityFromTable
{
}
然后,你需要的元数据类本身。是这样的:
Then you need the metadata class itself. Something like:
public class MyEntityFromTable_MD
{
[ScaffoldColumn(false)]
public object Id;
}
这篇关于动态数据实体ID列可见假的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!