Link to home
Start Free TrialLog in
Avatar of cdemott33
cdemott33Flag for United States of America

asked on

Best Pratice Newbie Question Regarding Custom Classes

I'm a newbie programmer so this might be a bit of a no-brainer for you experts, but I'm just looking for some guidence in regards to custom classes.

I created a class file called shipping.vb that lives in my App_Code folder

The Namespace in the shipping.vb file is called:
MyCompany.ProgramMnagement.DataLayer

I also have a public class within that namespace called 'shipping' and a function called 'InsertShippingRecord'.

In my code behind I do something like this to instantiate my class and use that function.

Dim myShippingClass As New MyCompany.ProgramManagement.DataLayer.Shipping()

I then write the following to utilize the InsertShippingRecord function of my shipping class:

Dim insertNewShippingRecord As Int32 = myShippingClass.InsertShippingRecord()

This all works perfectly.  No problems.

My quesiton is... is this the best way to do it?  

The other night I was thinking that maybe I could import the class, similar to the way I import System.Data.SqlClient at the top of my code behind page.  It sounded like a good idea but I'm not sure.

Any feedback would be greatly appriciated.
ASKER CERTIFIED SOLUTION
Avatar of GuitarRich
GuitarRich
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nasir Razzaq
I think you would be better using the LINQ or the Entity Framework.

http://msdn.microsoft.com/en-us/library/bb397897.aspx
http://msdn.microsoft.com/en-us/library/bb397897.aspx