解决方法
这是我如何管理(使用实体的扩展方法):
public static int? GetMaxLength(this EntityObject entite,string nomPropriete) { int? result = null; using (XEntities contexte = XEntities.GetCurrentContext()) { var queryResult = from Meta in contexte.MetadataWorkspace.GetItems(DataSpace.CSpace) .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType) from p in (Meta as EntityType).Properties .Where(p => p.DeclaringType.Name == entite.GetType().Name && p.Name == nomPropriete && p.TypeUsage.EdmType.Name == "String") select p.TypeUsage.Facets["MaxLength"].Value; if (queryResult.Count() > 0) { result = Convert.ToInt32(queryResult.First()); } } return result; }