Click here to Skip to main content
Click here to Skip to main content

Sharp RepoGen

, 7 May 2014
Rate this:
Please Sign up or sign in to vote.
Sharp RepoGen is a simple tool to create repository interface having methods for CRUD operation and its implementing class. Using this tool easily you can generate your repositry class and interface. Code is generated with the help of xml template, so very easily you may change the template to creat

Sample Image - maximum width is 600 pixels

Introduction

If you are planning to use Repository pattern in your project, then 'SharpRepoGen' is definitely going to be a best help for you. Using this you may avoid creating the similar pattern Repositry Classes and its interfaces. Using this tool easily you can generate your repositry class and interface. Code is generated with the help of xml template, so very easily you may change the template to create your source code as per your requirement. Section Tools, Design Pattern

Background

Repository Design pattern now a days has become very popular. This tool helps to implement the same without much effort.

Using the Code

Tool does most of the things for you, you simply need to provide your database credentials for which you want to create CRUD.

You simply need modify Template xml (basic setting done) to achieve your own naming conventions and coding standards.

Download the demo project and unzip the downloaded file.

  • You will see SharpRepoGen.exe file, double click it to Run.
  • Enter your database credentials and hit login.
  • You will be redirected to a new screen where, you will see your database tables on the left.
  • Select your tables for which you want to generate the repository classes. Use Ctrl + A and Ctrl + N to Select All/ Select None.
  • Hit F5 to generate the repository classes.
  • Select appropriate radio button Interface/ Repository Classes to see the files generated. You may click on file name to preview the same.
  • Hit Ctrl + T to modify the template if you want to modify the template.

    As discussed earlier, that source code is generated with the help of xmls, so that we can modify it easily. (Template.xml). So this option enables you to do the changes as per your need e.g. Changing namespace or any naming convention.

    Tool generates two objects, one is interface and another is its implementing class. Suppose, your table name is User, then it generate objects i.e. classes and interface with name IUserRepositry and UserRepository. Also, it generate CRUD functions as GetUsers, GetUserById, InsertUser, DeleteUser and UpdateUser. If you want any changes in these emails, you may change corresponding template (interface/ repository), highlighted below with yellow color.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Legalxgen.Entity.DataAccess;

namespace Legalxgen.DataAccess.Repository
!cur_brak_op#
    public interface I{0}Repository
    !cur_brak_op#
      IEnumerable<{0}> Get{0}s();
      {0} Get{0}ByID(int {1}Id);
      void Insert{0}({0} {1});
      void Delete{0}(int {1}Id);
      void Update{0}({0} {1});
      void Save();
    !cur_brak_cl#
!cur_brak_cl#

Points of Interest

On the development point of view its pretty straight forward, but on the usage side its quite waste, it reduces your effort to create these interfaces and classes.

License

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

About the Author

Ashish Tripathi
Founder Aspirea Technologies Pvt Ltd
India India
• 8 years of experience in IT Industry as a Developer.
• Experience of End-To-End Software Development and Implementation (Entire SDLC i.e Software Development Life Cycle)
• Real time Exposure to Banking, Finance and Energy industry.
• Expertise in distributed application architecture as well as web based applications using Microsoft.NET platform.
• Expertise in database design, SQL programming and SQL performance tuning.
• Expertise in Web Services and WCF Services.
• Experience of Rich Internet Application using Adobe Flex.
• Experience in migration of legacy application to latest technology, migration of VB application to .NET.
• Knowledge of OOPS and Design Concepts.
• Expertise in Agile/ Scrum software development processes.
 
Specialties
• Languages\ Technologies-
.NET Framework 1.1/2.0/3.0/3.5, C#.NET, VB.NET, ASP.NET, VB6, AJAX, ASP.NET, Adobe Flex 3.0, Web Services, Windows Communication Foundation (WCF), LINQ, SQL Server, Oracle, MySql, MS Access, HTML, XML, JavaScript, C# Script, CSS and XSLT.
 
• Methodology/ Concepts-
OOPS, Data Structures, Design Concepts and Agile/ Scrum Software Development
Follow on   Twitter

Comments and Discussions

 
QuestionMessage Automatically Removed PinmemberTú Camry8-May-14 0:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140718.1 | Last Updated 7 May 2014
Article Copyright 2014 by Ashish Tripathi
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid