Click here to Skip to main content
15,880,469 members
Articles / Web Development / ASP.NET

A N-Tier Architecture Sample with ASP.NET MVC3, WCF, and Entity Framework

Rate me:
Please Sign up or sign in to vote.
4.85/5 (91 votes)
11 Sep 2012CPOL48 min read 554.6K   31.7K   425  
This article tries to introduce a decoupled, unit-testable, deployment-flexible, implementation-efficient and validation-flexible N-Tier architecture in .NET

using System;
using System.Collections.Generic;
using System.ServiceModel;
using GH.Northwind.Business.Entities;

namespace GH.Northwind.Business.Interfaces
{
    [ServiceContract]
    public interface INorthwindSvr
    {
        [OperationContract]
        List<Customer> GetCustomers();

        [OperationContract]
        void InsertCustomer(Customer customer, bool commit);

        [OperationContract]
        void UpdateCustomer(Customer currentCustomer, bool commit);

        [OperationContract]
        void DeleteCustomer(String customerId, bool commit);

        [OperationContract]
        List<Order> GetOrders();

        [OperationContract]
        List<Order_Detail> GetOrderDetailForAnOrder(int orderId);

        [OperationContract]
        List<Order> GetOrderForACustomer(String customerId);

        [OperationContract]
        void CreateOrder(Order order, Order_Detail[] details);

        [OperationContract]
        void UpdateOrder(Order currentOrder, Order_Detail[] details, bool commit);

        [OperationContract]
        void DeleteOrder(int orderId, bool commit);

        [OperationContract]
        void DeleteAnOrderDetailFromAnOrder(int orderId, int orderDetailId, bool commit);

        [OperationContract]
        List<Product> GetProducts();

        [OperationContract]
        Product GetProductById(int id);

        [OperationContract]
        void InsertProduct(Product product, bool commit);

        [OperationContract]
        void UpdateProduct(Product currentProduct, bool commit);

        [OperationContract]
        void DeleteProduct(int productId, bool commit);

        [OperationContract]
        List<Category> GetProductCategories();

        [OperationContract]
        List<Supplier> GetSuppliers();

        [OperationContract]
        void Commit();
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions