Top "Custom-attributes" questions

In .NET Framework, custom attributes are user defined attributes which enable providing metadata for application elements such as assemblies, classes and methods.

Constructor Dependency Injection WebApi Attributes

I have been looking around for a non Parameter injection option for the WebApi attributes. My question is simply whether …

asp.net-web-api dependency-injection structuremap custom-attributes structuremap3
Passing custom parameter in custom attribute - ASP.NET MVC

My goal is to create a custom attribute like System.ComponentModel.DataAnnotations.Display which allows me to pass a parameter. …

c# asp.net-mvc custom-attributes
Remove a route with IOperationFilter in SwashBuckle

I am looking for a way to show/hide WebAPI routes in the Swagger documentation using SwashBuckle in a configurable …

c# asp.net-web-api swagger custom-attributes swashbuckle
Custom attribute with dash in name using EditorFor/TextBoxFor/TextBox helpers

I am using Knockout-JS to bind properties in my view to my view model. Knockout-JS uses a custom attribute called …

asp.net-mvc-3 razor custom-attributes
Is it possible to query custom Attributes in C# during compile time ( not run-time )

In other words could it be possible to create assembly, which does not even compile (assuming the checking code is …

c# custom-attributes
Attribute.IsDefined doesn't see attributes applied with MetadataType class

If I apply attributes to a partial class via the MetadataType attribute, those attributes are not found via Attribute.IsDefined(). …

c# linq-to-sql attributes metadata custom-attributes
Asp.net MVC - How to check session expire for Ajax request

We are using Ajax call across the application- trying to find out a global solution to redirect to login page …

asp.net-mvc custom-attributes ajax-request expired-sessions
Custom Attribute above a controller function

I want to put [FirstTime] attribute above a controller function and then create a FirstTimeAttribute that has some logic that …

c# asp.net-mvc-4 custom-attributes
MVC3 - Where to place custom attribute classes

I am delving into custom validation attributes and am curious to know how others structure the projects. Where do you …

asp.net-mvc-3 custom-attributes
Get the attributes from the interface methods and the class methods

Whats the best approach for getting the attribute values from a classes methods and from the interface methods when the …

c# reflection custom-attributes