I need to access other than default user profile service when multiple user profile services are associated to a single application. I use the below code but it always retrieves the default one set in the service application. I need to access other user profile services as well.
SPServiceApplicationProxyGroup applicationProxyGroup = SPFarm.Local.ServiceApplicationProxyGroups["Custom Proxy Group"];
SPServiceContext serviceContext = SPServiceContext.GetContext(applicationProxyGroup, SPSiteSubscriptionIdentifier.Default);