Unique Id for .Net Core actions

I need to have an ID for my actions to save them in DB and retrieve them for security issues. I thought this is a unique and constant Id but it is different in every run:

var items = _actionDescriptorCollectionProvider
                    .Select(a => new

Any idea for a unique and fixed ID for each action?

1 answer

  • answered 2021-04-21 19:05 Xerillio

    How about:

        .Select(a => new
            ControllerName = a.ControllerTypeInfo.FullName,
            ActionName = a.ActionName,
            ParameterTypes = a.Parameters
                .Select(p => p.ParameterType.Name) // Or FullName to be safe

    I think that should be unique enough.