private string GetCodeLine(IPermissionPolicyTypePermissionObject typePermissionObject, string operation, bool isGranted)
        {
            string securityPermissionState = GetSecurityPermissionState(isGranted);
            string typeName = typePermissionObject.TargetType.Name;

            return($"role.AddTypePermission<{typeName}>({operation}, SecurityPermissionState.{securityPermissionState});");
        }
        private List <string> GetCodeLinesFromTypePermissionObject(IPermissionPolicyTypePermissionObject typePermissionObject)
        {
            List <string> codeLines  = new List <string>();
            Type          targetType = typePermissionObject.TargetType;

            if (targetType != null)
            {
                nameSpacesCodeLines.Add(targetType.Namespace);
                OperationBuilder allowOperationBuilder = new OperationBuilder();
                OperationBuilder dennyOperationBuilder = new OperationBuilder();
                AddOperation(allowOperationBuilder, dennyOperationBuilder, typePermissionObject.ReadState, Operations.Read);
                AddOperation(allowOperationBuilder, dennyOperationBuilder, typePermissionObject.WriteState, Operations.Write);
                AddOperation(allowOperationBuilder, dennyOperationBuilder, typePermissionObject.CreateState, Operations.Create);
                AddOperation(allowOperationBuilder, dennyOperationBuilder, typePermissionObject.DeleteState, Operations.Delete);
                AddOperation(allowOperationBuilder, dennyOperationBuilder, typePermissionObject.NavigateState, Operations.Navigate);
                string allowOperations = allowOperationBuilder.GetOperations();
                if (allowOperations != string.Empty)
                {
                    codeLines.Add(GetCodeLine(typePermissionObject, allowOperations, true));
                }
                string dennyOperations = dennyOperationBuilder.GetOperations();
                if (dennyOperations != string.Empty)
                {
                    codeLines.Add(GetCodeLine(typePermissionObject, dennyOperations, false));
                }
                foreach (IPermissionPolicyObjectPermissionsObject objectPermissionObject in typePermissionObject.ObjectPermissions)
                {
                    codeLines.AddRange(GetCodeLinesFromObjectPermissionObject(objectPermissionObject));
                }
                foreach (IPermissionPolicyMemberPermissionsObject memberPermissionObject in typePermissionObject.MemberPermissions)
                {
                    codeLines.AddRange(GetCodeLinesFromMemberPermissionObject(memberPermissionObject));
                }
            }
            return(codeLines);
        }