Database Reference
In-Depth Information
{
}
public DbSet<Post> posts;
public DbSet<Comment> comments;
}
4.
Add an App.config file to the Recipe2 project, and copy the connection string from Listing 9-8.
Listing 9-8. The Connection String for the Recipe1 Class Library
<connectionStrings>
<add name="Recipe2ConnectionString"
connectionString="Data Source=.;
Initial Catalog=EFRecipes;
Integrated Security=True;
MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Next add a WCF service project to the solution. Use the default name Service1 just to
keep things simple. Change the IService1.cs file to reflect the new IService1 interface
in Listing 9-9.
5.
Listing 9-9. The Service Contract for Our Service
[ServiceContract]
public interface IService1
{
[OperationContract]
void Cleanup();
[OperationContract]
Post GetPostByTitle(string title);
[OperationContract]
Post SubmitPost(Post post);
[OperationContract]
Comment SubmitComment(Comment comment);
[OperationContract]
void DeleteComment(Comment comment);
}
6.
Change the service application code in the Service1.svc.cs file using the code from
Listing 9-10. Add a project reference to the Recipe2 class library and a using statement
so that the references to the POCO classes resolve correctly. You will also need to add a
reference to Entity Framework 6 libraries.
 
Search WWH ::




Custom Search