public static VendingMachineContext InstanceFactory(string connectionString) { if (instance == null) { instance = new VendingMachineContext(); } instance.connectionString = connectionString; return(instance); }
public static VendingMachineContext InstanceFactory() { if (instance == null) { instance = new VendingMachineContext(); } if (String.IsNullOrEmpty(instance.connectionString)) { throw new NullConnectionStringException(); } return(instance); }