Subsonic - The Perfect Database DAL Creator

by Fadl Assaad 12. October 2009 14:00
Share on Facebook

This topics may interest both beginner and advanced programmers,

We know that programmer always want to be more faster and more productive so he always search for helpful tactics, ways or tools that help him create big project in lesser time. But unfortunally we knew that dealing with database is the bigger part in a program and sometimes, if we have a big project, designing and engeneering of he Data Access Layer (DAL) of the project may take a lot of time which cause fatigue and Boredom ...

Is that right ? Not any more ...

Greate news for all, thanks for the Subsonic, a new technologie that read your database and converted automatically to code for example if we have a database that contains a table: Employees( ID, Name, Telephone).

The old fashion code is:

Dim Con As New SqlClient.SqlConnection("Data Source=Local;Initial Catalog=MyDatabase;Persist Security Info=True;User ID=sa;Password=sa;Pooling=true")
Dim sql As String = "Insert Into Employees(ID,Name,Telephone) Values(@ID,@Name,@Telephone)"
Dim da As New SqlClient.SqlCommand(sql, Con)
Try
   Dim oID As New SqlClient.SqlParameter("@ID", SqlDbType.Int, 8, ParameterDirection.Input)
   Dim oName As New SqlClient.SqlParameter("@Name", SqlDbType.Text, 50, ParameterDirection.Input)
   Dim oTelephone As New SqlClient.SqlParameter("@Telephone", SqlDbType.Text, 12, ParameterDirection.Input)
   oID.Value = txtID.Text
   oName.Value = txtName.Text
   oTelephone.Value = txtTelephone.Text
   da.Parameters.Add(oID)
   da.Parameters.Add(oName)
   da.Parameters.Add(oTelephone)
   Con.Open()
   da.ExecuteNonQuery()
   Con.Close()
Catch ex As Exception
   Throw ex
End Try

But with Subsonic:

Dim oEmp As New Employee
oEmp.ID = txtID.Text
oEmp.Name = txtName.Text
oEmp.Telephone = txtTelephone.Text
oEmp.Save()


That's it. Quiet Easy, Quiet Simple.

Also Read the Subsonic pdf file:

Tags: , , ,

Database | Programming

Online Chat

About The Skills Way Center

 Welcome!   This is Skills Way Center, A computer training center located in Mina, Tripoli, Lebanon.
More...

   

 

free counters

Google Translator

Recent Comments

Comment RSS
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010 Skills Way Center Blog