Ejemplo n.º 1
0
 public void ExecuteJoin()
 {
     try
     {
         IDbCommand cmd = JoinProvider.GetJoinCommand();
         Dictionary <string, MethodInfo> MethodDictionary = new Dictionary <string, MethodInfo>();
         foreach (string alias in JoinProvider.RepositoryDictionary.Keys)
         {
             MethodInfo m = JoinProvider.RepositoryDictionary[alias].GetMethod("AddFromReader");
             MethodDictionary.Add(alias, m);
             object     Repository = GetType().GetProperty(JoinProvider.TypeDictionary[alias].Name + Suffix).GetValue(this);
             object     DataStore  = Repository.GetType().GetField("JoinResults", BindingFlags.Public | BindingFlags.Instance).GetValue(Repository);
             MethodInfo Clear      = DataStore.GetType().GetMethod("Clear");
             Clear.Invoke(DataStore, new object[] {});
         }
         using (IDataReader oReader = cmd.ExecuteReader())
         {
             while (oReader.Read())
             {
                 foreach (string alias in MethodDictionary.Keys)
                 {
                     object Repository = GetType().GetProperty(JoinProvider.TypeDictionary[alias].Name + Suffix).GetValue(this);
                     MethodDictionary[alias].Invoke(Repository, new object[] { oReader, JoinProvider.IndexDictionary[alias] });
                 }
             }
         }
         JoinProvider = new JoinProvider(DbProvider);
     }
     catch (Exception e)
     {
         JoinProvider = new JoinProvider(DbProvider);
         throw e;
     }
 }
Ejemplo n.º 2
0
 public Context(IDookConfigurationOptions configuration)
 {
     DbType           = configuration.DatabaseType;
     ConnectionString = configuration.ConnectionString;
     DbProvider       = new DbProvider(DbType, ConnectionString, configuration.CommandTimeout);
     JoinProvider     = new JoinProvider(DbProvider);
     QueryProvider    = new QueryProvider(DbProvider);
     DbProvider.Connection.Open();
     DbProvider.Transaction = DbProvider.Connection.BeginTransaction();
     Suffix = configuration.Suffix;
 }
Ejemplo n.º 3
0
 public Context(string ConnectionString, DbType DbType, string Suffix = "Repository")
 {
     this.DbType           = DbType;
     this.ConnectionString = ConnectionString;
     DbProvider            = new DbProvider(DbType, ConnectionString);
     JoinProvider          = new JoinProvider(DbProvider);
     QueryProvider         = new QueryProvider(DbProvider);
     DbProvider.Connection.Open();
     DbProvider.Transaction = DbProvider.Connection.BeginTransaction();
     this.Suffix            = Suffix;
 }