Project Introduction
This section will modify the example of a guest book in The Learning LINQ to SQL (iii): Adding and deleting changes to a multi-tier architecture using WCF. We will establish the following projects:
L A, website Project WebSite: Guest Book Presentation layer
L B, Class Library project Contract: Defines a contract for data access services
L C, Class Library project service: Defining Data access Services
L D, Class Library project entity: Guest Book entity
L E, console Project host: Hosting data access Services
The references between projects are as follows:
L A references B and D;
L B references D and System.ServiceModel assemblies
L C References B, D, System.ServiceModel, and System.Data.Linq assemblies
L D Reference SYSTEM.DATA.LINQ Assembly
l e references C and System.ServiceModel assemblies
Generating mapping files and entities
Open the VS2008 command line prompt and execute the following command:
sqlmetal /conn:server=xxx;database=GuestBook;uid=xxx;pwd=xxx /map:c:\guestbook.map /code:c:\guestbook.cs /serialization:Unidirectional
Note that here we use the serialization switch to tell SQLMetal to automatically mark them as WCF data objects when they are generated. C:\GUESTBOOK after the build is finished. CS added to the entity project.