예제 #1
0
        private static void ListAppliances()
        {
            var dbPath = GetPlugwiseDatabase();

            Console.WriteLine("Loading Plugwise data from {0}", dbPath);

            string dbConnString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + dbPath + "';Persist Security Info=False;";

            try
            {
                using (var connection = new OleDbConnection(dbConnString))
                    using (var db = new PlugwiseDataContext(connection))
                    {
                        var allapps = (from app in db.Appliances select app);
                        foreach (var app in allapps)
                        {
                            Console.WriteLine("{0} =\t{1}", app.Name.PadRight(15, ' '), app.ID);
                        }
                    }
            }
            catch (InvalidOperationException)
            {
                // Assume an OLE DB Provider problem
                if (_verbose)
                {
                    DumpProviders();
                }
                throw;
            }
        }
예제 #2
0
 public Loader(FileInfo database)
     : this()
 {
     string dbConnString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + database + "';Persist Security Info=False;";
     _connection = new OleDbConnection(dbConnString);
     _db = new PlugwiseDataContext(_connection);
 }
예제 #3
0
        public Loader(FileInfo database)
            : this()
        {
            string dbConnString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + database + "';Persist Security Info=False;";

            _connection = new OleDbConnection(dbConnString);
            _db         = new PlugwiseDataContext(_connection);
        }