Click here to Skip to main content
15,887,135 members
Articles / Programming Languages / C#

Build Data Access Layer and Entity Layer in 20 Seconds

Rate me:
Please Sign up or sign in to vote.
1.87/5 (14 votes)
5 Nov 2007CPOL2 min read 47.9K   551   25   12
Give the Oracle Connection string and Get the DAL and Entity Layer in 5 steps
Screenshot - Demo.jpg

Introduction

The small utility tool has been developed for rapid development of Data Access Layer and Entity Layer.

I am a Software Programmer and I have to make Data Access Layer and Entity Layer for the procedures I made in Oracle. For each parameter in Procedure, I have to create a property with get and set in Entity Layer Class and have to build oracleParameterCollection in DAL. For the procedures that have 30 to 40 parameters, I have to code around 600 lines, which is very boring and time consuming.

I decided that most of the things of DAL and Entity layer are static, only the property and variable name change, why can I loop through each parameter of Procedure and make code string for every parameter.

So, my first problem is how to get all the procedure names and then all the parameter names of procedure. I found SQL Queries for that and also found .NET method of our OracleConnection class, obj_Connection.getSchema() which gives us all the data about the current connection with current Oracle schema.

Finally the application has been developed and now you can make your DAL and Entity Layer within 20 seconds in 5 steps.

You just need to give your connection string.

Select the Procedure, click on make Entity, Make DAL Button and you will get the code.

You can directly save Entity and DAL as .cs file.

Background

The Setting menu available in the application allows you to set Prefix and Suffix of variables and properties that are generated in the application automatically.

Using the Tool

  1. Paste your Oracle Connection string and Click the Set Connection String Button, which will show you all the procedures of the current schema.
  2. Select the procedure you want to make DAL and Entity layer for and click the Get Parameter Button. It will show you all the parameters with its DataType and Input/output type.
  3. Select the parameter for which you want to create properties and OracleParameter Collection. (You can select all parameters by clicking Toggle All link.)
  4. Click on Make Entity and you will get your complete Entity layer class. In the same way, you will get your DAL also, you can store it as .cs file.
  5. You can set Default Namespaces and class name from Setting Menu.

Points of Interest

Get happiness out of your work or you may never know what happiness is.

- Hubbard Elbert

History

  • 5th November, 2007: Initial post

License

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


Written By
Software Developer (Senior) Trigyn Technologies Ltd.
India India
Govind Bhanushali
Analyst Programmer

Make a difference today. Smile | :)

Comments and Discussions

 
GeneralMy vote of 1 Pin
azeez9122-Feb-10 12:37
azeez9122-Feb-10 12:37 
QuestionCan it do packages? Pin
datavalue1-Jul-08 22:06
datavalue1-Jul-08 22:06 
QuestionCan give sql connection string to Your application? Pin
do ly viet hung6-Nov-07 13:54
do ly viet hung6-Nov-07 13:54 
AnswerRe: Can give sql connection string to Your application? Pin
Govind Bhanushali6-Nov-07 20:28
Govind Bhanushali6-Nov-07 20:28 
GeneralDon't use bold text Pin
Colin Angus Mackay5-Nov-07 22:51
Colin Angus Mackay5-Nov-07 22:51 
GeneralCrap again Pin
NormDroid5-Nov-07 21:48
professionalNormDroid5-Nov-07 21:48 
GeneralRe: Crap again Pin
Sudhir Mangla5-Nov-07 22:08
professionalSudhir Mangla5-Nov-07 22:08 
GeneralRe: Crap again Pin
NormDroid5-Nov-07 22:15
professionalNormDroid5-Nov-07 22:15 
GeneralRe: Crap again Pin
Govind Bhanushali6-Nov-07 3:05
Govind Bhanushali6-Nov-07 3:05 
GeneralRe: Crap again Pin
NormDroid6-Nov-07 3:12
professionalNormDroid6-Nov-07 3:12 
GeneralRe: Crap again Pin
Sudhir Mangla6-Nov-07 5:06
professionalSudhir Mangla6-Nov-07 5:06 
badly formatted is the right word. But do not use the word Crap. We should not demotivate the new members.

Sudhir Mangla

http://DevelopersVoice.com
(VC++ FAQ, MFC FAQ, C++ FAQ)
http://Programmerworld.net
(Free books and source code)

http://Faq.Programmerworld.net
(FAQ and Tips for programmers)
GeneralRe: Crap again Pin
NormDroid6-Nov-07 20:44
professionalNormDroid6-Nov-07 20:44 

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

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