我怎样才能连接到 UI 渲染“引擎”? ASP.NET 动态数据?

发布于 2024-07-10 18:08:22 字数 318 浏览 7 评论 0原文

我使用通过 MetadataType 属性附加到我的模型类的元数据类来装饰我的模型。 我有一些使用 Range 属性、Required 属性等。以及我创建的一些自定义属性。

现在我想连接到动态数据框架的渲染引擎(或任何名称),并且能够根据我的自定义属性以及标准 System.ComponentModel.DataAnnotations 属性更改 UI 的呈现方式。

另外,我可能想使用 ASP.NET MVC,所以请记住这一点。

我怎么做? 如果您不想冗长地解释细节,那么向我指出链接会很棒。

谢谢!

I have decorated my model using Metadata classes attached to my model classes via the MetadataType attribute. I have some use the Range attribute, Required attribute, etc. and some custom attributes I have created.

Now I want to hook into the rendering engine (or whatever it is called) of the Dynamic Data framework and be able to change the way the UI is rendered based on my custom attributes as well as the standard System.ComponentModel.DataAnnotations attributes.

Also, I might want to use ASP.NET MVC, so keep that in mind.

How do I do that? Pointing me to links would be great if you don't want to be verbose about explaining the nitty-gritty.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独守阴晴ぅ圆缺 2024-07-17 18:08:22

有一个 ASP.NET MVC 的动态数据项目,但我认为它几乎处于搁置状态:

http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=15459

我不久前看过它,它部分起作用,但我不认为它适用于最新的位。 我认为最终他们会将一切整合在一起,但这需要一些时间。 我现在所做的是我有一些辅助类来读取元数据,例如显示必需的字段,但我没有使用动态数据的完整渲染。 您可以像这样提取元数据:

public static MetaColumn GetColumn(Type t, string columnName)
{
  MetaModel model = new MetaModel();
  MetaTable table = model.GetTable(t);
  MetaColumn column = table.GetColumn(columnName);
  return column;
}

public static string GetDisplayName(Type t, string columnName)
{
  MetaColumn column = GetColumn(t, columnName);
  return column.DisplayName;
}

现在我只使用一些元数据。 想知道你是否能想出比这更进一步的东西。

There is a dynamic data project for ASP.NET MVC, but I think it is pretty much on hold:

http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=15459

I looked at it a while back and it partly worked, but I don't think it works with the latest bits. I think eventually they are going to pull everything together, but it will be some time. What I do right now is I have some helper classes that read the metadata for example to show required fields, but I am not using the full blown rendering of dynamic data. You can pull the metadata like this:

public static MetaColumn GetColumn(Type t, string columnName)
{
  MetaModel model = new MetaModel();
  MetaTable table = model.GetTable(t);
  MetaColumn column = table.GetColumn(columnName);
  return column;
}

public static string GetDisplayName(Type t, string columnName)
{
  MetaColumn column = GetColumn(t, columnName);
  return column.DisplayName;
}

For now I'm just using some of the metadata. Would like to know if you come up with anything further that this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文