コード例 #1
0
ファイル: Connection.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Connects to a store
 /// </summary>
 /// <param name="connect">
 /// The store connection string
 /// </param>
 public void Open(String connect)
 {
     if (this.store != null)
     throw new ConnectionException(Strings.ConnectionAlreadyConnected);
      Store.IStore store = null;
      try
      {
     // parse connection string parameters
     var connectionString = ConnectionString.Parse(connect);
     // determine the store name
     var storeName = connectionString.Store;
     var knownStore = (String)null;
     if (knownStores.TryGetValue(storeName, out knownStore))
        storeName = knownStore;
     // attempt to load the store type
     var storeType = Type.GetType(storeName, true);
     store = (Store.IStore)Activator.CreateInstance(storeType);
     // bind the store properties and connect
     connectionString.Bind(store);
     // connect to the store
     store.Open();
     this.connectionString = connectionString;
     this.store = store;
      }
      catch (Exception e)
      {
     if (store != null)
        store.Dispose();
     throw new ConnectionException(e);
      }
 }
コード例 #2
0
 public FormHandler(IMailSender mailSender, IStateService lookups, Store.IStore store)
 {
     _mailSender = mailSender;
     _lookupContext = lookups;
     _store = store;
 }
コード例 #3
0
ファイル: Connection.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Closes the open connection
 /// </summary>
 public void Close()
 {
     if (this.store != null)
     this.store.Dispose();
      this.store = null;
      this.connectionString = null;
 }