Skip to content
| Marketplace
Sign in
Visual Studio>Tools>NCodeBox
NCodeBox

NCodeBox

Sahbi JABNOUNI

|
628 installs
| (0) | Free
NCodeBox is a set of tools and libraries for generating RESTFul solution from your domain model. It uses the SOLID and Domain Driven Design principles to provide a low coupled solution easy to test and maintain.
Download

Solution Generator for Microsoft Visual Studio

NCodeBox is a set of tools and libraries for generating RESTFul solution from your domain model. It uses the SOLID and Domain driven design principles to provide a low coupled solution easy to test and maintain.

 

 

Getting Started

How to use NCodeBox for generating Restful solution

Overview

1:Implement Domain Model Project

  • Create new Class Library Project with Visual Studio
  • Install NcodeBox.Domain from Package Manager Console
        PM> Install-Package NCodeBox.Domain    
  • Add classes [Class should implement the interface IIdentity]
     using NCodeBox.Domain;    using System;    using System.Collections.Generic;        namespace BookStore.BusinessObjects    {        public class Author:IIdentity<Guid>        {            public Guid Id { get; set; }            public string FirstName { get; set; }            public string LastName { get; set; }            public ICollection<Book> Books { get; set; }        }    }     
      using System;    using NCodeBox.Domain;        namespace BookStore.BusinessObjects    {        public class Book:IIdentity<Guid>        {            public Guid Id { get; set; }            public string Title { get; set; }            public string Description { get; set; }            public string Language { get; set; }            public DateTime PublishDate { get; set; }            public Guid AuthorId { get; set; }            public Author Author { get; set; }        }     }     

2-Install NCodeBox

3-Select you Domain Model Project and run Generate Solution From NCodeBox Menu

  • The generated projects are Repositories.Contracts,Respositories,Services.Contracts,Services,Validation and WebApi.

4-Install Packages

  • Install NCodeBox.Domain in the Repositories.Contracts project
        PM> Install-Package NCodeBox.Domain    
  • Install NCodeBox.Domain,EntityFramework in Repositories project
        PM> Install-Package NCodeBox.Domain    
  • Install NCodeBox.Domain,NCodeBox.Domain.Validation in Services.Contracts,Services projects
        PM> Install-Package NCodeBox.Domain    
        PM> Install-Package EntityFramework    
  • Install NCodeBox.Domain,NCodeBox.Domain.Validation in Validation project
        PM> Install-Package NCodeBox.Domain    
  • Install NCodeBox.Domain,NCodeBox.Domain.EF,NCodeBox.Domain.Validation,EntityFramework,Autofac.WebApi in WebApi project
        PM> Install-Package NCodeBox.Domain    

5-Generate Database

The generated repositories contains Context class is used for generating/accessing the Database.
  • Add app.config to the repositories project,and add the connection string in the app.config (the connection should be the same as is passed to the Context Class ex:BookstoreContext)
  • Select Repositories project and use Enable-Migrations and Update-Database to generate your database
        PM> Enable-Migrations    
        PM> Update-Database    
        using System.Data.Entity;    using BookStore.BusinessObjects;    namespace BookStore.Repositories    {        public class BookStoreContext : DbContext        {            public BookStoreContext(string connstring)                : base(connstring)            {                this.Configuration.LazyLoadingEnabled = false;            }                public BookStoreContext()                : base("name=BookStoreContext")            {                this.Configuration.LazyLoadingEnabled = false;            }                public DbSet<Author> Authors { get; set; }            public DbSet<Book> Books { get; set; }        }    }    

6-Set Up the Web-Api

  • Add the same connection string in web.config in the Web-Api Project.Now The Resful solution is ready.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft