如何访问其他的“一般”一个EntityModel中的Entity-Property属性在T4内? [英] How can I access other then the "General" attributes of a Entity-Property from a EntityModel within a T4?

查看:106
本文介绍了如何访问其他的“一般”一个EntityModel中的Entity-Property属性在T4内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码来获取实体的所有属性。

I am using sort of the following code to get all properties of a entity

IList<EdmProperty> list = entity.Properties.Where(p => p.TypeUsage.EdmType is PrimitiveType && p.DeclaringType == entity)

然后我遍历这些列表,访问每个Property并读取Property Properties(是的,很多属性,希望没有人会困惑)。

Then I iterate through these list, access each Property and read the Property Properties (Yeah, much properties, hope no one gets to confused).

虽然我可以轻松访问常规属性我不知道如何访问其他属性的实体 - 如最大长度& 固定长度

While I can easily access the General attributes I don't know how to access the other Properties of the the Entity-Property like Max Length & Fixed Length

推荐答案

这些属性不是 PrimitiveType 。它们直接位于 p.TypeUsage Facets 属性之下。

Those properties are not part of PrimitiveType. They are directly in p.TypeUsage under Facets property.

这篇关于如何访问其他的“一般”一个EntityModel中的Entity-Property属性在T4内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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