Wrox Programmer Forums
|
BOOK: Professional WCF 4: Windows Communication Foundation with .NET 4
This is the forum to discuss the Wrox book Professional WCF 4: Windows Communication Foundation with .NET 4 by Pablo Cibraro, Kurt Claeys, Fabio Cozzolino, Johann Grabner; ISBN: 978-0-470-56314-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional WCF 4: Windows Communication Foundation with .NET 4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2011, 08:12 AM
Registered User
 
Join Date: Aug 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation CHAPTER 11 CREATING A SOA CASE - Customer ambiguity

Hi,

Enjoying a good read going through the complete example scenario in chapter 11 CREATING A SOA CASE " bit by bit. But in the "Creating Database Access for the CustomerService and the RentalService" section page 317 I get a bit confused.

Is this an error, or is it supposed to be like this. What are the overall picture of whats happening here?

In the CustomerService project I added the "LINQ to SQL Classes" (DataClassesCustomer.dbml) and dragged in the Customer table from the CarRentalCaseDB database in Server Explorer.

Fine, but when writing the code to CustomerServiceImplementation.cs I discovered that the 'Customer' class now had changed from beeing a CustomerInterface.Customer into beeing a CustomerService.Customer type.

Code:
Code:
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;
using CustomerInterface;

namespace CustomerService
{
    public class CustomerServiceImplementation:ICustomer
    {
        public int RegisterCustomer(Customer customer)

        // prior to creating DataClassesCustomer.dbml:
        // public int RegisterCustomer(CustomerInterface.Customer customer)
        // 
        // After creating DataClassesCustomer.dbml:
        // public int RegisterCustomer(CustomerService.Customer customer)

        {
            Console.WriteLine("RegisterCustomer()");
            using (DataClassesCustomerDataContext ctx = new DataClassesCustomerDataContext())
            {
                Customer customerToInsert;
                customerToInsert = new Customer();
                customerToInsert.CustomerName = customer.CustomerName;
                customerToInsert.CustomerFirstName = customer.CustomerFirstName;
                ctx.Customers.InsertOnSubmit(customerToInsert);
                ctx.SubmitChanges();
                return customerToInsert.CustomerID;
            }
        }
    }
}
This does not happen in the similar creation of DataClassesRental.dbml, as the class names differ.

A Customer class is defined in the CustomerInterface project (ICustomer.cs), then used to define function parameters in the CustomerServices project (CustomerServiceImplementation.cs).

A Customer table with some identically named fields is created in the database.

Customer table is then used in the DataClassesCustomer.dbml to define a partial Customer class in the DataClassesCustomer.designer.cs file.

Which finally causes the Customer found in CustomerServiceImplementation.cs to change from beeing a CustomerInterface.Customer class to beeing a CustomerService.Customer.

Now, coincidence in this example maybe, or is this a normal happening?

Why this and are there any good guidelines/explanation on how to deal with this?

Is this an error that may cause errors in certain situations?

Hope for some good answers here:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 11 Creating relationships between tables bpl BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 November 13th, 2009 11:59 AM
chapter 11 figure 11-7 relative positioning pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 November 29th, 2007 06:11 AM
Ch 11 creating a user reg script ed123 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 September 28th, 2007 11:36 AM
creating a customer wishlist janice ASP.NET 1.0 and 1.1 Basics 7 September 30th, 2004 11:08 AM
Chp 11 - Creating htaccess JamesA BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 6 June 15th, 2004 08:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.