質問

I have an ASP.Net Dynamic Data linq-to-SQL website with two tables I'm generating a gridview for. System_States and System_Counties. In System_Counties there's a foreign key that points to the state it's in, in the System_States table. In order to have a user friendly table and column name, I have

[MetadataType(typeof(StateMetadata))]
public partial class System_State
{
}

[DisplayName("States")]
public class StateMetadata
{
    ....

Which works nicely, but now I've lost the auto-pluralization used by Linq-to-SQL. Before I used DisplayName, The States table had System_States over it, but the column in the Counties grid showing which state it was in said System_State. But now with [DisplayName("States")] both the States table header and the County column name are "States." Is there a built in way for me to still have a plural and singular name when using DisplayName?

役に立ちましたか?

解決

I created a custom meta attribute to handle single and plural usage :

[SingularTableName("Budget")]

[DisplayName("Budgets")]

public partial class Budget { }

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top