Overview

Library WCF Service is a two-project solution consisting of a WCF SOAP service (LibraryWCFService) and a C# console client (LibraryClient). The service exposes a [ServiceContract] interface defining nine operations for managing an in-memory book catalog. The console client connects via a generated Service1Client proxy and provides a menu-driven interface for library staff to add, update, delete, search, and check books in and out.

Features

  • AddBook — adds a new book with server-side validation for title, author, ISBN length, and duplicate ISBN detection
  • UpdateBook — updates title and author for an existing book by ISBN
  • DeleteBook — removes a book from the catalog by ISBN
  • ListBooks — retrieves and displays all books in the catalog
  • SearchByTitle — case-insensitive partial-match search across all titles
  • SearchByAuthor — case-insensitive partial-match search across all authors
  • SearchByISBN — exact-match lookup by ISBN
  • CheckOutBook — marks a book as unavailable; rejects if already checked out
  • ReturnBook — marks a checked-out book as available again
  • Console client with tabular formatted output using fixed-width column alignment

Screenshots

Listing All Books Listing All Books

Returning a Book Returning a Book

Code Highlights

// IService1.cs — WCF service contract and Book data contract
[ServiceContract]
public interface IService1
{
    [OperationContract] string AddBook(Book book);
    [OperationContract] string UpdateBook(string isbn, string newTitle, string newAuthor);
    [OperationContract] string DeleteBook(string isbn);
    [OperationContract] List<Book> ListBooks();
    [OperationContract] List<Book> SearchByTitle(string title);
    [OperationContract] List<Book> SearchByAuthor(string author);
    [OperationContract] List<Book> SearchByISBN(string isbn);
    [OperationContract] string CheckOutBook(string isbn);
    [OperationContract] string ReturnBook(string isbn);
}

[DataContract]
public class Book
{
    [DataMember] public string Title       { get; set; }
    [DataMember] public string Author      { get; set; }
    [DataMember] public string ISBN        { get; set; }
    [DataMember] public bool   IsAvailable { get; set; }
}

Challenges & Solutions

Challenge: Defining a clean contract boundary between the service and client without leaking implementation details.
Solution: All nine operations are declared on the IService1 interface using [ServiceContract] and [OperationContract], with the Book model serialized via [DataContract] — the client depends only on the generated proxy and never on the service implementation directly.

Challenge: Persisting book state across multiple client calls within a stateless HTTP request model.
Solution: The service uses a private static List<Book> field, shared across all instances for the lifetime of the service host, allowing operations like CheckOutBook and ReturnBook to modify and observe consistent state between calls.