Let's go back and remove our inline code from our previous applications and replace it with Data Access Objects.
Let's start off by cleaning up our
Program.cs
orModule1.vb
class a little. We want to remove all of the code from theMain()
method, except for thelog4net.Config.XmlConfigurator.Configure()
and theContact
andAddress
object creation. When you are done, your method should look as follows:static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); Contact contact = new Contact("Joe", "Jones", "[email protected]"); Address address = new Address("2000 E. Captive Way", null, "Madville", "MA", "78701"); address.Contact = contact; contact.Addresses = new List<Address>(); contact.Addresses.Add(address); }
The VB.NET method should look very similar:
Sub Main() log4net.Config.XmlConfigurator.Configure() Dim contact As New Contact("Joe", "Jones", "[email protected]") Dim address As New...