Introduction to WCF CRUDS

Abstract

In this tutorial we'll learn developing cross-process, cross-platform distributed windows applications using CRUD2CRUD (CRUDS) communication architecture.

CRUDS implementation using IService, IServiceAsync, IWCFService and IWCFServiceAsync inherits ICRUD, ICRUDL and ICRUDM (extension for communication generalization). IWCFService and IWCFServiceAsync are implemented to support ICRUDM that lacks support for serialization of a polymorphic object.

Keywords: WindnTrees, CRUD, CRUD2CRUD, CRUDS
  • Design

    CRUD is a data persistence reference design pattern where as CRUD2CRUD is a distributed application architecture that enable data communication on well defined CRUD interfaces across different subsystems of a distributed application. Reference design is interface unanimous amongst services and clients, forming a CRUD2CRUD communication channel without persistence. Clients and Services are independent of each other and data communicated for persistence or retrieval may be in second or third tier of CRUD2CRUD (CRUD2CRUD2CRUD). CRUD2CRUD is integration freedom. CRUDView and CRUDController forms first tier of communication in web applications. ServiceClient and ServiceRepository forms first tier of communication in windows applications.

    CRUDView     ==== Employee  =====   CRUDLController (Or ServiceRepository)
    

    Strategy

    To achieve tutorial objectives we'll develop:

    1. Application Server Project
    2. Console Application Client (.NET Framework)
    3. Console Application Client (.NET Core Framework)
    4. Shared Library Project (.NET Standard)

    Database Requirements

    We'll not be interacting with database rather present cross process communication using CRUD2CRUD communication architecture and will be avoiding details about how to write and configure database CRUDS ServiceRepository. Developer may update ApplicationContext for database connectivity.

    Application Server Project

    1. Setup windows .NET Framework console application project.
    2. Install WindnTrees.CRUDS nuget package.
    3. Write service respositories for .NET Framework and .NET Core Framework
    4. Create new ApplicationServer class and inherit from WindnTrees.CRUDS.Server class.
    5. Host service repositories in ApplicationServer.

    Console Application Client (.NET Framework)

    1. Setup windows .NET Framework console application project.
    2. Install WindnTrees.ICRUDS nuget package.
    3. Configure channels (IService, IServiceAsync, IWCFService, IWCFServiceAsync) with bindings and endpoints. IServiceAsync is extended definition of IService with Begin and End method definitions. IWCFServiceAsync is extended definition of IWCFService with Begin and End method definitions.
    4. Instantiate ServiceClient with appropriate channel factory and channel interface.

    Console Application Client (.NET Core Framework)

    1. Setup windows .NET Core Framework console application project.
    2. Install WindnTrees.ICRUDS.Standard nuget package.
    3. Configure channels (IService, IServiceAsync, IWCFService, IWCFServiceAsync) with bindings and endpoints. IServiceAsync is extended definition of IService with Begin and End method definitions. IWCFServiceAsync is extended definition of IWCFService with Begin and End method definitions.
    4. Instantiate ServiceClient with appropriate channel factory and channel interface.

  • Shared Library Project

    Defines model definitions required to communicate data accross and within different components of a sub-system. There are two types of models defined, one that may participate in ApplicationDbContext (EntityFramework) for data saving and persistance needs. Second types of models are adapted models that convert EntityFramework models in WCF compliant object models for communication.

    CRUDS Service Repositories

    WindnTrees CRUDS support following repositories:

    1. EntityRepository (Internal or Subsystem CRUD2CRUD repository)
    2. ServiceRepository (Cross-Process CRUD2CRUD or CRUDS repository)
    3. AdapterServiceRepository (Cross-Process CRUD2CRUD or CRUDS repository that provide conversion between internal and CRUD2CRUD repository objects)

    All repositories support IService, IWCFService except for EntityRepository that only support ICRUD, ICRUDL and ICRUDM.

    Nuget Packages

    WCF CRUDS (CRUD2CRUD) are based on following nuget packages.

    1. WindnTrees.CRUDS
    2. WindnTrees.ICRUDS
    3. WindnTrees.ICRUDS.Standard
    4. WindnTrees.CRUDS.Repository

    Summary

    WindnTrees.CRUDS provide efficient means of developing cross-process cross-platform distributed applications using CRUD2CRUD communication architecture. Download project code here.