c# - How can get access to Unity container in a class library ActionFilterAttribute? -
so, have web project utilizes unity inject userrepository
interfaces iuserrepository
. have class library contains custom actionfilterattribute
. custom attribute class used on many actions already. want add code check value in database based on user. this, need access userrepository
. old fashioned way using statements , directly access userrepository
, utilize di , resolve iuserrepository
. how can access web resolving iuserrepository
to, inside custom attribute class since actionfilterattribute
needs empty constructor?
attributes metadata objects. shouldn't involved in database access. use separate service read attribute values , result access database.
Comments
Post a Comment