Ask a questionAsk a question
 

AnswerAdApiFaultDetail and the various places it is defined.

  • Friday, July 24, 2009 4:18 PMJimNickFL Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have code that can be used for Sandbox or Production depending on a compile flag. If the flag is SANDBOX I use the Service References for the Sandbox and fif it isn't defined, I use the Production Service References. In addition I use the appropriate names in the Service constructors from the app.config file. My question is this:

    Since I have using statement for several Services in my ciode, the AdApiFaultDetail is defined in several places and is ambiguous. If I select one to use then switch to a different mode (Sandbox to Production for instance) The location is nolonger valid for the definition of AdApiFaultDetail. How cabn I get arounf this?

Answers

  • Friday, July 31, 2009 10:29 PMJeff Dillon - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

    We are doing the same thing here, and have Production and Sandbox access in the same app, but don't run into multiple definitions. I have a single CampaignManagementService.cs in my project. Within that file, there is a single class definition:

    public partial class AdApiFaultDetail : Microsoft.AdApi.ApplicationFault
    {...}

    In the code, we have something similar to:

    if (chkSand.Checked)
     svcCampMgt = new CampaignManagementServiceClient("Sandbox_BasicHttpBinding_ICampaignManagementService");
    else
     svcCampMgt = new CampaignManagementServiceClient("BasicHttpBinding_ICampaignManagementService");

    Ah, I see. You are doing it at compile time, and I am doing here at runtime. But does this help? I guess you would have the wrap each definition within #ifdef

    Jeff Dillon, API Support

All Replies

  • Friday, July 31, 2009 10:29 PMJeff Dillon - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

    We are doing the same thing here, and have Production and Sandbox access in the same app, but don't run into multiple definitions. I have a single CampaignManagementService.cs in my project. Within that file, there is a single class definition:

    public partial class AdApiFaultDetail : Microsoft.AdApi.ApplicationFault
    {...}

    In the code, we have something similar to:

    if (chkSand.Checked)
     svcCampMgt = new CampaignManagementServiceClient("Sandbox_BasicHttpBinding_ICampaignManagementService");
    else
     svcCampMgt = new CampaignManagementServiceClient("BasicHttpBinding_ICampaignManagementService");

    Ah, I see. You are doing it at compile time, and I am doing here at runtime. But does this help? I guess you would have the wrap each definition within #ifdef

    Jeff Dillon, API Support