c # – Encapsulation of authorization logic, while avoiding circular dependencies

I'm trying to encapsulate the permissions logic for a particular view model so that permissions logic has access to the view template object, but is also exposed to the view. inside of it.

Trivial implementation:

Public class ClientViewModel
{
public Client Client {get; together; }

/ * permissions section * /
public bool CanVote => Client.Age> 18
public bool CanDrink => Client.Age> 21
}

The implementation is quite clean and simple. The view will have to make many decisions based on the set of properties available in the permissions. But since there will be a lot of permissions, I would ideally like this logic to be contained elsewhere.

At the moment, I can access like this:

var vm = new ClientViewModel () {Client = myClient};
vm.CanVote

But J & # 39; would contain all the logic within the same class and access like this:

vm.Permissions.CanVote

Circular implementation

I can therefore put a property of type ClientViewModelPermissions on the ViewModel itself. It must have access to the data objects on the ViewModel that it describes so that I can pass the instance of the model in the Permissions constructor and create it during model construction, like this:

Public class ClientViewModel
{
public ClientViewModel ()
{
// create an instance of permissions for the current object
Permissions = new ClientViewModelPermissions (this);
}

public Client Client {get; together; }

public permissions ClientViewModelPermissions {get; together; }
}

Public class ClientViewModelPermissions
{
public ClientViewModelPermissions (ClientViewModel clientVm)
{
// permissions must describe a particular view template
ClientModel = clientVm;
}

private ClientViewModel ClientModel {get; together; }

public bool CanVote => ClientModel.Client.Age> 18
public bool CanDrink => ClientModel.Client.Age> 21
}

So each class contains a reference to the other as a property. Should this be avoided for any reason? Is there a simpler way of evaluating the properties of a given class, but separating that logic from the class itself by decorating it in one way or another?