initialize the repository at runtime based on a string
Posted: Fri Nov 30, 2012 1:45 am
I have two Repositories IntegrationRepo and OtherEnvironmentRepo. I am trying to initialize the repository at runtime based on a string (domain where I am running), but getting error:
************************************************************
//code snippet sample:
// declare the repo with base class
RepoGenBaseFolder repo;
//initialize the Repo based on the string strDomain
repo = strDomain == "integration.testdomain.com" ? IntegrationRepo.Instance : OtherEnvironmentRepo.Instance;
Type of conditional expression cannot be determined because there is no implicit conversion between 'IntegrationRepo' and 'OtherEnvironmentRepo' (CS0173)
How can I solve this?
************************************************************
//code snippet sample:
// declare the repo with base class
RepoGenBaseFolder repo;
//initialize the Repo based on the string strDomain
repo = strDomain == "integration.testdomain.com" ? IntegrationRepo.Instance : OtherEnvironmentRepo.Instance;
Type of conditional expression cannot be determined because there is no implicit conversion between 'IntegrationRepo' and 'OtherEnvironmentRepo' (CS0173)
How can I solve this?