Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6794


Ignore:
Timestamp:
09/17/11 18:31:34 (11 years ago)
Author:
abeham
Message:

#1619

  • Updated Hello (test) service, tested db publishing
Location:
branches/GeneralizedQAP/HeuristicLab.Services.Hello/3.3
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Services.Hello/3.3/HelloService.svc.cs

    r6780 r6794  
    2020#endregion
    2121
     22
     23using System;
    2224namespace HeuristicLab.Services.Hello {
    2325  public class HelloService : IHelloService {
     
    2527      return "Hello";
    2628    }
     29
     30    public string Say(string phrase) {
     31      using (HelloEntities context = new HelloEntities()) {
     32        Saying s = context.Sayings.CreateObject();
     33        s.message = phrase.Length > 256 ? phrase.Substring(0, 256) : phrase;
     34        s.date = DateTime.Now;
     35        context.Sayings.AddObject(s);
     36        context.SaveChanges();
     37      }
     38      return phrase;
     39    }
    2740  }
    2841}
  • branches/GeneralizedQAP/HeuristicLab.Services.Hello/3.3/HeuristicLab.Services.Hello-3.3.csproj

    r6780 r6794  
    3131    <ErrorReport>prompt</ErrorReport>
    3232    <WarningLevel>4</WarningLevel>
     33    <PublishDatabaseSettings>
     34      <Objects>
     35        <ObjectGroup Name="HelloEntities-Deployment" Order="1" Enabled="True">
     36          <Destination Path="Data Source=SERVICES%3bInitial Catalog=HelloDatabase%3bIntegrated Security=True" />
     37          <Object Type="dbFullSql" Enabled="False">
     38            <PreSource Path="Data Source=LOCALHOST\SQLEXPRESS%3bInitial Catalog=HelloDatabase%3bIntegrated Security=True" ScriptSchema="True" ScriptData="False" CopyAllFullTextCatalogs="False" />
     39            <Source Path="obj\Release\AutoScripts\HelloEntities-Deployment_SchemaOnly.sql" Transacted="True" />
     40          </Object>
     41          <Object Type="dbFullSql" xmlns="" Enabled="False">
     42            <Source Path="SQLScripts\CreateDatabase.sql" Transacted="False" />
     43          </Object>
     44        </ObjectGroup>
     45      </Objects>
     46    </PublishDatabaseSettings>
    3347  </PropertyGroup>
    3448  <ItemGroup>
    3549    <Reference Include="Microsoft.CSharp" />
     50    <Reference Include="System.Data.Entity" />
     51    <Reference Include="System.Security" />
    3652    <Reference Include="System.Web.DynamicData" />
    3753    <Reference Include="System.Web.Entity" />
     
    5470  <ItemGroup>
    5571    <Content Include="HelloService.svc" />
     72    <Content Include="SQLScripts\CreateDatabase.sql" />
    5673    <Content Include="Web.config" />
    5774    <Content Include="Web.Debug.config">
     
    6380  </ItemGroup>
    6481  <ItemGroup>
     82    <Compile Include="HelloModel.Designer.cs">
     83      <AutoGen>True</AutoGen>
     84      <DesignTime>True</DesignTime>
     85      <DependentUpon>HelloModel.edmx</DependentUpon>
     86    </Compile>
    6587    <Compile Include="HelloService.svc.cs">
    6688      <DependentUpon>HelloService.svc</DependentUpon>
     
    7193  <ItemGroup>
    7294    <Folder Include="App_Data\" />
     95  </ItemGroup>
     96  <ItemGroup>
     97    <EntityDeploy Include="HelloModel.edmx">
     98      <Generator>EntityModelCodeGenerator</Generator>
     99      <LastGenOutput>HelloModel.Designer.cs</LastGenOutput>
     100    </EntityDeploy>
    73101  </ItemGroup>
    74102  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • branches/GeneralizedQAP/HeuristicLab.Services.Hello/3.3/IHelloService.cs

    r6780 r6794  
    2121
    2222using System.ServiceModel;
     23using System.ServiceModel.Web;
    2324
    2425namespace HeuristicLab.Services.Hello {
     
    2627  public interface IHelloService {
    2728    [OperationContract]
     29    [WebGet(UriTemplate = "SayHello")]
    2830    string SayHello();
     31
     32    [OperationContract]
     33    [WebGet(UriTemplate = "Say/{phrase}")]
     34    string Say(string phrase);
    2935  }
    3036}
  • branches/GeneralizedQAP/HeuristicLab.Services.Hello/3.3/Web.Release.config

    r6780 r6794  
    88    <compilation xdt:Transform="RemoveAttributes(debug)" />
    99  </system.web>
     10  <connectionStrings>
     11    <add xdt:Transform="Replace" name="HelloEntities" connectionString="metadata=res://*/HelloModel.csdl|res://*/HelloModel.ssdl|res://*/HelloModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=SERVICES;Initial Catalog=HelloDatabase;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
     12  </connectionStrings>
    1013
    1114</configuration>
  • branches/GeneralizedQAP/HeuristicLab.Services.Hello/3.3/Web.config

    r6780 r6794  
    33
    44  <system.web>
    5     <compilation debug="true" targetFramework="4.0" />
     5    <compilation debug="true" targetFramework="4.0">
     6      <assemblies>
     7        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     8      </assemblies>
     9    </compilation>
    610  </system.web>
     11 
    712  <system.serviceModel>
     13    <bindings>
     14      <webHttpBinding> <!-- separate bindings are necessary -->
     15        <binding name="jsonBinding" />
     16        <binding name="xmlBinding" />
     17      </webHttpBinding>
     18    </bindings>
     19   
    820    <behaviors>
    921      <serviceBehaviors>
    1022        <behavior>
    11           <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
    12           <serviceMetadata httpGetEnabled="true"/>
    13           <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
    14           <serviceDebug includeExceptionDetailInFaults="false"/>
     23          <serviceMetadata httpGetEnabled="true" />
     24          <serviceDebug includeExceptionDetailInFaults="true" />
    1525        </behavior>
    1626      </serviceBehaviors>
     27     
     28      <endpointBehaviors>
     29        <behavior name="xmlEndpoint">
     30          <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Xml" />
     31        </behavior>
     32        <behavior name="jsonEndpoint"> <!-- do not specify enableWebScript or UriTemplate will not work -->
     33          <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" />
     34        </behavior>
     35      </endpointBehaviors>
    1736    </behaviors>
     37   
     38    <services>
     39      <service name="HeuristicLab.Services.Hello.HelloService"> <!-- name needs to match the service entry in the .svc markup file -->
     40        <!-- URL: HelloService.svc -->
     41        <!-- URL: HelloService.svc?wsdl -->
     42        <endpoint name="soap" address="" binding="basicHttpBinding" contract="HeuristicLab.Services.Hello.IHelloService" />
     43        <endpoint name="mex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
     44        <!-- URL: HelloService.svc/json/... -->
     45        <!-- URL: HelloService.svc/json/help -->
     46        <endpoint name="restJson" address="json" binding="webHttpBinding" bindingConfiguration="jsonBinding" contract="HeuristicLab.Services.Hello.IHelloService" behaviorConfiguration="jsonEndpoint" />
     47        <!-- URL: HelloService.svc/xml/... -->
     48        <!-- URL: HelloService.svc/xml/help -->
     49        <endpoint name="restXml" address="xml" binding="webHttpBinding" bindingConfiguration="xmlBinding" contract="HeuristicLab.Services.Hello.IHelloService" behaviorConfiguration="xmlEndpoint" />
     50      </service>
     51    </services>
     52   
    1853    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    1954  </system.serviceModel>
    20  <system.webServer>
    21     <modules runAllManagedModulesForAllRequests="true"/>
     55 
     56  <system.webServer>
     57    <modules runAllManagedModulesForAllRequests="true" />
    2258  </system.webServer>
    2359 
     60  <connectionStrings>
     61    <add name="HelloEntities" connectionString="metadata=res://*/HelloModel.csdl|res://*/HelloModel.ssdl|res://*/HelloModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=LOCALHOST\SQLEXPRESS;Initial Catalog=HelloDatabase;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
     62  </connectionStrings>
    2463</configuration>
Note: See TracChangeset for help on using the changeset viewer.