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.
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 {publicclassAuthor:IIdentity<Guid>{public Guid Id {get;set;}publicstring FirstName {get;set;}publicstring LastName {get;set;}public ICollection<Book> Books {get;set;}}}
using System;using NCodeBox.Domain;namespace BookStore.BusinessObjects {publicclassBook:IIdentity<Guid>{public Guid Id {get;set;}publicstring Title {get;set;}publicstring Description {get;set;}publicstring 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