After installing the software you will have to follow the following steps to make it completely workable.
1. Create your tables (as per your database design)
2. Create abstract classes
3. Extend the abstract classes
4. Store them in App_Code folder in your website
5. Executing the dooDad's stored procedures
Now lets come step by step
1. Table creation
I think people already know this how to create a table in the a database. Let me remind one important thing those who are working SQL Server 2005 or higher. While connecting to the database then:
Server: (local)\sqlexpress
Here we often write (local)/sqlexpress and generally get an error number 40. Those who are suffering this problem it can be cure for them. Though it is expected people are acquainted with process of table creation however let me give a clear view.
a. Click Server Explorer from View
b. Find Data Connections
c. Data Connection>Create New SQL server database
d.Server: (local)\sqlexpress
e. Now let database name Test..
f. Test>Tables>New Table
g. Generate different fields
h. Save the table
2. Create abstract class
When your expected tables are created then actually your interaction with database is really over. Now mygeneration tool will take care of all the things. So open mygeneration tool and follow the steps.
a.Open>Templates>C#>CSharp_SQL_BusinessObject
b. Execute
c. Now fill the following like these
Output File Path: C:/test folder/
Namespace: TestNamespace
Select a database:Test
Select Table: Maximus
Select Language: C# (default)
d. Press Ok
Now you will find an abstract class named Maximus.cs, but the class file in it named as
_Maximus. It will have following type of code
namespace TestNamespace
{
public class _Maximus
{
/* different codes*/
}
}
So rename the Maximus.cs to _Maximus.cs. And this is the abstract class file for you
which will be used for further database operations
3. Extend abstract class
This is very simple. Lets follow the steps
a. Create a Maximus.cs class file from VS
b. Now open the file and write the following code
public class Maximus: TestNamespace._Maximus
{
}
c. Now save the Maximus.cs file.
4. Store these files
Now an important thing is to store these files where. Follow these steps
a. Create/Open the App_Code folder in your website
b. Create two folder in it named DAL and BO
c. Now store _Maximus.cs in DAL
d. And store Maximus.cs in BO
e. As you storing these files in App_Code so these class files will be automatically complied.
5. Execute the stored procedure
a. Open Mygeneration tool
b. File>New>Mygeneration Project>Add template instance
A window will popup. Now insert the following info
name:test
Template: Microsoft SQL Server>d00Dads Stored Procedures
c. Now click Record Template input
Now another window will popup
d. Insert info like this
Output file path:C:/test/
Select a database: Test
Select table: Maximus
Press Button Ok. and return to previous window and also press Ok
e. You will discover test like
New Project >test
f. Now right click on test and select execure
Here you will find a black screen giving message that stored procedure created successfuly.
g. Now open C:/test. Here you will find a file Maximus.sql
h. Open this file using Mygeneration tool
i. Then execute from toolbar
Now your duty is finished. get relaxed and you can do all database works just calling Maximus class. Now from your website in any page you can create code like this:
Maximus maxOb=new Maximus();
maxOb.Name="Masud";
maxOb.Roll=040201;
where Name and Roll are fields of Maximus table you created. However thats all for today.
Next time I will be more specific using example.
thanks.
Masud(3.7.9)
No comments:
Post a Comment