문제

I understand that .NET attribute values do not change during run-time by design.

However, is there a way I could roll my own dynamic ScaffoldColumn or ReadOnly attribute to use in a Dynamic Data project? So that the value is conditionally true or false, depending on say the URL of the request?

I don't wish to rewrite the templates or create "custom pages" - however small modifications to the templates is OK.

I'll accept no as an answer.

도움이 되었습니까?

해결책

you can dynamically add or change attributes [i mean attributes reported by PropertyDescriptor (which is obtained by TypeDescriptior.GetProperties) not the ones queried by reflection]. ASP.Net uses TypeDescriptor approach not reflection but in a web environment you cant be sure noone is requesting a page by the time you temporary make modifications. attributes are global accross your app. so only option is editing and adding conditional statements to templates.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top