← Projects — CIS 266
Library WCF Service
A SOAP-based WCF web service and C# console client for managing an online library, supporting full CRUD operations, book search, and check-out/return functionality over a service contract interface.
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 detectionUpdateBook— updates title and author for an existing book by ISBNDeleteBook— removes a book from the catalog by ISBNListBooks— retrieves and displays all books in the catalogSearchByTitle— case-insensitive partial-match search across all titlesSearchByAuthor— case-insensitive partial-match search across all authorsSearchByISBN— exact-match lookup by ISBNCheckOutBook— marks a book as unavailable; rejects if already checked outReturnBook— marks a checked-out book as available again- Console client with tabular formatted output using fixed-width column alignment
Screenshots
Listing All Books
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.

