Ejemplo n.º 1
0
        public static void SetConfig()
        {
            var defaultLocation = new ConfigLocationHelper();
            var sqlLoader       = new FileSqlLoader(defaultLocation.SQLStatement);

            connDesc  = DBContextHelper.Instance.getConfiguration();
            dbManager = new PetaPocoContextManager(new[] { sqlLoader }, new[] { connDesc });
            dbManager.SetContextExecutionMode(DBContextExecutionMode.ByName);
        }
Ejemplo n.º 2
0
        //[TestMethod]
        public void TestMethod1()
        {
            IFileLoader loader    = new FileSqlLoader("file-sql-loader", AppDomain.CurrentDomain.BaseDirectory + @"\App_Code\SqlFiles");
            IDbManager  dbManager = new Common.Database.Petapoco.PetapocoDbManager(null, null);

            //// initialize sql loader and connection descriptor
            dbManager.AddSqlLoader(loader);

            dbManager.ConnectionDescriptor.Add(new ConnectionDescriptor()
            {
                ConnectionString = @"DATA SOURCE=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = tcp)(HOST = batuampar.idbpn.chevronCommon.net)(PORT = 1521)))(CONNECT_DATA =(SID = ih10bpnd))); USER ID=MIMSWH; PASSWORD=mimswh4devel#2012;",
                IsDefault        = true,
                ProviderName     = "System.Data.OracleClient",
                Name             = "MIMSWH"
            });

            IDataCommand  db     = dbManager.GetDatabase("MIMSWH");
            List <object> result = db.Query <object>("SELECT * FROM tddistrict", null);
        }