• Using an Existing SQL Instance With Azure SDK


    原文: http://azurecoding.net/blogs/brownie/archive/2008/11/21/using-an-existing-sql-instance-with-azure-sdk.aspx

    David Justice provided this tip on his blog. But if you already have access to a SQL Server Installation, you're not limited to using SQL Express. You don't even have to use a local SQL installation.  Just open developmentstorage.exe.config in your Azure SDK Bin directory and change the two lines that refer to sqlexpress to point to the instance you want.

    Also there is a command line parameter for devtablegen that you have to pass in order to get it to generate the tables on an instance other than the default SQLExpress. Passing /server:<myserver[\myinstancename]> to devtablegen will cause it to generate your table storage on a SQL instance with the same name. In fact, if you're going to be using the Samples with a predetermined SQL Instance, you might as well change it so that rundevstore.cmd will generate the tables for you. I did the digging so you don't have to. First we want to change the Microsoft.Samples.ServiceHosting.Targets file. This file is ultimately responsible for calling devtablegen.

    1. Insert a line after the opening for the property group at the top of the file (line 3)
    2. Paste these lines into the file

      <!-- Allow user to pass the server parameter to devtablegen -->
      <DevStoreParam Condition="'$(InstanceName)'!=''">/server:$(InstanceName)</DevStoreParam>
      <DevStoreParam Condition="'$(InstanceName)'==''"></DevStoreParam>

    3. Replace the UpdateSamplesTableDB (do a search but should be near line 130) with the following

      <Target Name="UpdateSamplesTableDB" DependsOnTargets="BuildSubProjects">
          <Message Text="$(DevTableGenCommand) $(DevStoreParam) /database:$(SamplesDBName) $(DevtableGenForceCreateFlag) @(DevTableGenAssemblies)"/>
          <Exec Condition="'$(SamplesDBName)'!=''"
                  Command="$(DevTableGenCommand) $(DevStoreParam)  /database:$(SamplesDBName) $(DevtableGenForceCreateFlag) @(DevTableGenAssemblies)"
          WorkingDirectory="$(MSBuildProjectDirectory)"/>
        </Target>

    What we did here was allow a parameter called InstanceName to be passed into MSBuild that will be passed to devtablegen. All we have to do now is update rundevstore.cmd to pass in the parameter. Replace line 21 in rundevstore.cmd with the following:

    %msbuild% MSBuild\BuildAll.proj   /t:RunDevStoreOnSamplesTableDB /p:SamplesDBName=ServiceHostingSDKSamples;ForceTableCreate=true;InstanceName=.

    Replace . at the end with your instance name (unless it's the default instance on local, in that case . is the shortcut for that). Open your Windows Azure SDK Prompt, navigate to your samples directory, execute rundevstore and voila, you've broken the chains to SQL Express.

    What's that you say, too lazy to do all that file opening, cutting and pasting? Have no fear! Here are the sample files for your convenience.

    Microsoft.Samples.ServiceHosting.targets

    rundevstore.cmd

    Published Friday, November 21, 2008 12:52 AM by Mike Brown
  • 相关阅读:
    关于分布式的一些理解和认识
    Git使用详细教程
    Kettle 7启动 Spoon.bat 时报错“A Java Exception has occurred.”的解决方法
    postgresql 9源码安装
    intel笔记本cpu型号后缀详解(M,U,QM,MQ,HQ,XM)
    LAMP部署流水
    四种mysql存储引擎
    MySQL日志
    MySQL存储引擎总结
    MySQL存储引擎中的MyISAM和InnoDB
  • 原文地址:https://www.cnblogs.com/smwikipedia/p/1438430.html
Copyright © 2020-2023  润新知