mirror of
https://github.com/farcasclaudiu/myfriendsaround.git
synced 2026-06-29 13:02:05 +03:00
init commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<%@ Application Codebehind="Global.asax.cs" Inherits="MyFriendsAround.WcfREST.Global" Language="C#" %>
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.ServiceModel.Activation;
|
||||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace MyFriendsAround.WcfREST
|
||||
{
|
||||
public class Global : HttpApplication
|
||||
{
|
||||
void Application_Start(object sender, EventArgs e)
|
||||
{
|
||||
RegisterRoutes();
|
||||
}
|
||||
|
||||
private void RegisterRoutes()
|
||||
{
|
||||
// Edit the base address of Service1 by replacing the "Service1" string below
|
||||
RouteTable.Routes.Add(new ServiceRoute("Service1", new WebServiceHostFactory(), typeof(Service1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3C17B729-9737-446A-81F5-6862C98AACE0}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyFriendsAround.WcfREST</RootNamespace>
|
||||
<AssemblyName>MyFriendsAround.WcfREST</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<UseIISExpress>false</UseIISExpress>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceModel.Web" />
|
||||
<Reference Include="System.ServiceModel.Activation" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Web.Release.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Service1.cs" />
|
||||
<Compile Include="SampleItem.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MyFriendsAround.Common\MyFriendsAround.Common.csproj">
|
||||
<Project>{80664694-C63F-4653-B3FC-617AEC468B3C}</Project>
|
||||
<Name>MyFriendsAround.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MyFriendsAround.Data.BLL\MyFriendsAround.BLL.csproj">
|
||||
<Project>{C78D400C-204A-4FAE-B63E-4D86A9871641}</Project>
|
||||
<Name>MyFriendsAround.BLL</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>38284</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MyFriendsAround.WcfREST")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("MyFriendsAround.WcfREST")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("dbb48f14-e281-4d34-b051-53e129936a26")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace MyFriendsAround.WcfREST
|
||||
{
|
||||
// TODO: Edit the SampleItem class
|
||||
public class SampleItem
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string StringValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Activation;
|
||||
using System.ServiceModel.Web;
|
||||
using System.Text;
|
||||
using MyFriendsAround.Common.Entities;
|
||||
using MyFriendsAround.Data.BLL;
|
||||
|
||||
namespace MyFriendsAround.WcfREST
|
||||
{
|
||||
// Start the service and browse to http://<machine_name>:<port>/Service1/help to view the service's generated help page
|
||||
// NOTE: By default, a new instance of the service is created for each call; change the InstanceContextMode to Single if you want
|
||||
// a single instance of the service to process all calls.
|
||||
[ServiceContract]
|
||||
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
|
||||
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
|
||||
// NOTE: If the service is renamed, remember to update the global.asax.cs file
|
||||
public class Service1
|
||||
{
|
||||
// TODO: Implement the collection resource that will contain the SampleItem instances
|
||||
|
||||
[WebGet(UriTemplate = "")]
|
||||
public List<SampleItem> GetCollection()
|
||||
{
|
||||
// TODO: Replace the current implementation to return a collection of SampleItem instances
|
||||
return new List<SampleItem>() { new SampleItem() { Id = 1, StringValue = "Hello" } };
|
||||
}
|
||||
|
||||
[WebInvoke(UriTemplate = "", Method = "POST")]
|
||||
public SampleItem Create(SampleItem instance)
|
||||
{
|
||||
// TODO: Add the new instance of SampleItem to the collection
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[WebGet(UriTemplate = "{id}")]
|
||||
public SampleItem Get(string id)
|
||||
{
|
||||
// TODO: Return the instance of SampleItem with the given id
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[WebInvoke(UriTemplate = "{id}", Method = "PUT")]
|
||||
public SampleItem Update(string id, SampleItem instance)
|
||||
{
|
||||
// TODO: Update the given instance of SampleItem in the collection
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[WebInvoke(UriTemplate = "{id}", Method = "DELETE")]
|
||||
public void Delete(string id)
|
||||
{
|
||||
// TODO: Remove the instance of SampleItem with the given id from the collection
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
[WebGet(UriTemplate = "GetFriends", ResponseFormat = WebMessageFormat.Json)]
|
||||
public List<Friend> GetFriends()
|
||||
{
|
||||
List<Friend> list = FriendsRepository.GetFriends();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
[OperationContract]
|
||||
[WebInvoke]
|
||||
public bool PublishLocation(Friend friend)
|
||||
{
|
||||
return FriendsRepository.PublishLocation(friend);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
|
||||
<system.web>
|
||||
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<connectionStrings>
|
||||
<add name="MyFriendsModelContainer" connectionString="metadata=res://*/MyFriendsModel.csdl|res://*/MyFriendsModel.ssdl|res://*/MyFriendsModel.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQL2008;initial catalog=MyFriends;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
|
||||
</connectionStrings>
|
||||
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.0" />
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</modules>
|
||||
</system.webServer>
|
||||
|
||||
<system.serviceModel>
|
||||
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
|
||||
<standardEndpoints>
|
||||
<webHttpEndpoint>
|
||||
<!--
|
||||
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
|
||||
via the attributes on the <standardEndpoint> element below
|
||||
-->
|
||||
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
|
||||
</webHttpEndpoint>
|
||||
</standardEndpoints>
|
||||
</system.serviceModel>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user